Buongiorno a TUTTI Volevo sapere come convertire la funzione fsockopen in curl in questo codice php.
Grazie.
<?php if(strpos($con = ini_get("disable_functions"), "fsockopen") === false) {if(is_resource($fs =fsockopen("www.livescore.in", 80, $errno, $errstr, 3))!($stop = $write = !fwrite($fs, "GET /it/free/lsapi HTTP/1.1\r\nHost: www.livescore.in\r\nConnection: Close\r\nlsfid: 724776\r\n\r\n"))) {$content = "";while (!$stop && !feof($fs)) {$line = fgets($fs, 128);($write || $write = $line == "\r\n") && ($content .= $line);}fclose($fs);$c = explode("\n", $content);foreach($c as &$r) {$r = preg_replace("/^[0-9A-Fa-f]+\r/", "", $r);}$content = implode("", $c);} else $content .= $errstr."(".$errno.")<br />\n";} elseif(strpos($con, "file_get_contents") === false && ini_get("allow_url_fopen")) {$content = file_get_contents("http://www.livescore.in/it/free/lsapi", 0, stream_context_create(array("http" => array("timeout" => 3, "header" => "lsfid: 724776 "))));} elseif(extension_loaded("curl") && strpos($con, "curl_") === false) {curl_setopt_array($curl = curl_init("http://www.livescore.in/it/free/lsapi"), array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array("lsfid: 724776 ")));$content = curl_exec($curl);curl_close($curl);} else {$content = "Non possiamo caricare l'inScore in PHP. Chiedi al tuo hosting provider di abilitare la funzione `file_get_contents` e l'ordine `allow_url_fopen` o la funzione `fsockopen`.";}echo $content; ?>
Grazie.
<?php if(strpos($con = ini_get("disable_functions"), "fsockopen") === false) {if(is_resource($fs =fsockopen("www.livescore.in", 80, $errno, $errstr, 3))!($stop = $write = !fwrite($fs, "GET /it/free/lsapi HTTP/1.1\r\nHost: www.livescore.in\r\nConnection: Close\r\nlsfid: 724776\r\n\r\n"))) {$content = "";while (!$stop && !feof($fs)) {$line = fgets($fs, 128);($write || $write = $line == "\r\n") && ($content .= $line);}fclose($fs);$c = explode("\n", $content);foreach($c as &$r) {$r = preg_replace("/^[0-9A-Fa-f]+\r/", "", $r);}$content = implode("", $c);} else $content .= $errstr."(".$errno.")<br />\n";} elseif(strpos($con, "file_get_contents") === false && ini_get("allow_url_fopen")) {$content = file_get_contents("http://www.livescore.in/it/free/lsapi", 0, stream_context_create(array("http" => array("timeout" => 3, "header" => "lsfid: 724776 "))));} elseif(extension_loaded("curl") && strpos($con, "curl_") === false) {curl_setopt_array($curl = curl_init("http://www.livescore.in/it/free/lsapi"), array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array("lsfid: 724776 ")));$content = curl_exec($curl);curl_close($curl);} else {$content = "Non possiamo caricare l'inScore in PHP. Chiedi al tuo hosting provider di abilitare la funzione `file_get_contents` e l'ordine `allow_url_fopen` o la funzione `fsockopen`.";}echo $content; ?>