HTTP POST Client/Server
Hi all,
Well i am trying to sent a small xml message via http post method to a specified server.
I have managed to connect to that server but i haven't manage to upload my xml data.
My code looks like:
$fp = fsockopen($host,80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET /HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp,$out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
echo "connected<br/>";
fclose($fp);
}
Well this script shows me that i am connected but the right thing is to sent the xml file with my username and pwd to connect to that server.
Can anyone help me please?
Thank you.
thanks
|