hi,
go to http://www.phpclasses.org/httpclient and download the httpclient class.
it has a example file (test_http_post.php)
or you can test it with the following scripts :
*************************************
receieve.php ( the script who recieves the file)
<?
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name']))
{
if (copy($HTTP_POST_FILES['userfile']['tmp_name'],'recievedfile.file'))
echo "FILE IS RECIEVED size: ". $HTTP_POST_FILES['userfile']['size'];
else
echo "FILE IS RECIEVED. BUT COULD NOT COPY FILE";
}
else
echo "No file is recieved";
?>
***************************************************
***************************************************
send.php
<?php
require("http.php");
$http=new http_class;
$http->timeout=0;
$http->data_timeout=0;
$url="http://domain/recieve.php";
$file_to_be_posted=file_get_contents("line.gif");
$error=$http->GetRequestArguments($url,$arguments);
$arguments["RequestMethod"]="POST";
$arguments["PostValues"]=array(
"submit"=>"Send",
"MAX_FILE_SIZE"=>"1000000"
);
$arguments["PostFiles"]=array(
"userfile"=>array(
"Data"=>$file_to_be_posted,
"Name"=>"line.gif",
"Content-Type"=>"automatic/name",
)
);
$http->Open($arguments);
http->SendRequest($arguments);
$http->ReadReplyHeaders($headers);
$http->ReadReplyBody($body,1000);
echo HtmlSpecialChars($body);
$http->Close();
***************************************************
regards,
Umut ATASEVER |