ClaveAudio_Web/ped_v_start.php

37 lines
940 B
PHP
Raw Permalink Normal View History

<?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');
?>