Code: Select all
$request = 'site=' . $site . '&stats=' . urlencode($stats);
$headers = 'POST /parse.php HTTP/1.0' . "\r\n";
$headers .= 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
$headers .= 'Content-Length: ' . strlen($request) . "\r\n\r\n";
//send request
if ($fileStream = fsockopen('www.example.com', 80, $errno, $errstr, 30))
{
fwrite($fileStream, $headers . $request);
$contents = '';
while (!feof($fileStream))
{
//get the contents, 1kb at a time
$contents .= fgets($fileStream, 1024);
}
echo $contents;
} else
{
echo $errno . ': ' . $errstr;
}$contents IS echoing, but the contents is a 404 page. I know for a fact that the script I'm POSTing to exists.
Hmmm?