
Andrew Gill - 2008-07-15 16:41:06
I can send the post and read the reply body fine. However, the post value arguments are not being sent... I think I am missing something simple in my code. Any ideas?
The code is really short and simple... Any clues much appreciated! :-)
<?php
require("http.php");
set_time_limit(0);
$http=new http_class;
$http->timeout=0;
$http->data_timeout=0;
$http->debug=0;
$http->html_debug=1;
$url="http://localhost/http_test/test_receive.php";
$arguments["RequestMethod"]="POST";
$arguments["PostValues"]=array(
"test2"=>"ZZZZ",
"test"=>"ABC!!");
$arguments["PostFiles"]=array(
"userfile"=>array(
"Data"=>"This is just a plain text attachment file",
"Name"=>"test.txt",
"Content-Type"=>"automatic/name"));
$arguments["Referer"]="http://www.agtest.com/";
$error=$http->GetRequestArguments($url,$arguments);
$error=$http->Open($arguments);
$error=$http->SendRequest($arguments);
$error=$http->ReadReplyHeaders($ReplyHeaders,100);
$error=$http->ReadReplyBody($body,10000);
//print_r (array_keys($ReplyHeaders));
//echo "<br/>BODY = ".HtmlSpecialChars($body);
echo $body;
$http->Close();
?>