git-svn-id: https://192.168.0.254/svn/Proyectos.ClaveAudio_Web/trunk@2 44ade383-bb54-5b4f-835b-923f7702b206
37 lines
940 B
PHP
37 lines
940 B
PHP
<?php
|
|
function sendToHost($host, $method, $path, $data)
|
|
{
|
|
// Supply a default method of GET if the one passed was empty
|
|
if (empty($method)) {
|
|
$method = 'GET';
|
|
}
|
|
$method = strtoupper($method);
|
|
// $fp = fsockopen('https://' . $host, 443);
|
|
$fp = fsockopen($host, 443);
|
|
if ($method == 'GET') {
|
|
$path .= '?' . $data;
|
|
}
|
|
fputs($fp, "$method $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");
|
|
|
|
if ($method == 'POST') {
|
|
fputs($fp, $data . "\r\n\r\n");
|
|
}
|
|
|
|
|
|
while (!feof($fp)) {
|
|
$buf .= fgets($fp,128);
|
|
}
|
|
fclose($fp);
|
|
return $buf;
|
|
}
|
|
|
|
sendToHost('https://tpv.4b.es',
|
|
'post',
|
|
'/tpvv/teargral.exe',
|
|
'uno=ClaveAudio&dos=040797920');
|
|
|
|
?>
|