Code: Select all
function post($host, $path, $data) {
$http_response = '';
$content_length = strlen($data);
$fp = fsockopen($host, 80);
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-Length: $content_length\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data);
while (!feof($fp)) $http_response .= fgets($fp, 28);
fclose($fp);
return $http_response;
}
$postdata = '?foo=bar';
foreach($_POST as $key => $val) $postdata .= '&'.$key.'='.$val;
$http_response = post('example.org', '/path/to/script.php', $postdata);
and how the response lenght could be?
thanks
and as a hint if you know how I code encrypt this code cause i'm gonna use this code for activating my script
thanks