Hello
I'm trying to post some variables to a php page
function httpPost($fields, $url = '/sms.php')
{
$qs = array();
foreach ($fields as $k => $v)
$qs[] = $k.'='.urlencode($v);
$qs = join('&', $qs);
$errno = $errstr = '';
if ($fp = @fsockopen('xxx.xxx.com', 80, $errno, $errstr, 30))
{
fputs($fp, "POST ".$url." HTTP/1.1\r\n");
fputs($fp, "Host: xxx.xxx.com\r\n");
fputs($fp, "User-Agent: MSIE\r\n");
fputs($fp, "Content-Type: text/www-form-urlencoded\r\n");
fputs($fp, "Content-Length: ".strlen($qs)."\r\n");
fputs($fp, "Connection: close\r\n");
fputs($fp, "\r\n".$qs);
$content = '';
while (!feof($fp))
$content .= fgets($fp, 1024);
fclose($fp);
return preg_replace("/^.*?\r\n\r\n/s", '', $content);
}
return false;
}
the problem is that the page that receive the post doesn't receive the variables.
Can you help me?