I'm trying to send some info to my other site using a post request,for some reason the code returns a 403 error(Forbidden), did I do sumthin' wrong below???
<?php
define('CRLF', chr(13).chr(10));
$action="http://www.site2.com/guests.php";
$socketz = parse_url($action);
$path = '/guests.php';
$body = 'name=guestz&high=yes';
$headers =
'POST '.$path.' HTTP/1.1'.CRLF
.'Host: '.$host.CRLF
.'Content-type: application/x-www-form-urlencoded'.CRLF
.'Content-length: '.strlen($body).CRLF;
if(!$fp = fsockopen($socketz[host], 80, $errno, $errstr, 5))
{
echo "<center>Could not open a socket connection with <b>'$action'</b>" . $errstr.' ('.$errno.')<br>';
exit;
}
else
{
fputs($fp, $headers.CRLF);
fputs($fp, $body);
while(!feof($fp))
{
$readme .= fread($fp, 128);
}
if(!ereg("HTTP/1.[0-1]{1} 200",$readme))
{
echo"<center>Ok.....</center>" . "$back";
}
else
{
echo $readme . $back;
exit;
}
}
//etc
?>
Thanks in advance!