//Функция отправки данных на шлюз методом POST
function getRequest(){
$data = "password=root&Uid=345";//Чё хочешь пиши, какбудто GET , а отправлять будем POST
$url = parse_url("http://куда отправлять);
if ($url['scheme'] != 'http') {
die('Only HTTP request are supported !');
}
$host = $url['host'];
$path = $url['path'];
$fp = fsockopen($host,80);
// send the request headers:
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: ". strlen($data) ."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data);
$result = '';
while(!feof($fp)) {
// receive the results of the request
$result .= fgets($fp, 128);
}
fclose($fp);
$exp=explode("Content-Type: text/html",$result);
$res = trim($exp[1]);
if($res == 'Ответ с того кода OK'){
return true;
}
return false;
}