Salve,
sto cercando di usare una curl per ottenere l'html di una pagina internet ma ho dei problemi.
Premetto che ho già rimosso la restrizione server2server inviando il codice tramite sms ma nulla.
Il codice che utilizzo è questo:
ma mi ritorna sempre questo:Codice PHP:
$url = "http://www.google.it";
$fp = fsockopen($url, 80);
if ($fp) {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: {$url}\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$code = "";
while (!feof($fp)) {
$code.= fgets($fp, 256);
}
fclose($fp);
echo $code;
}
Qualcuno può aiutarmi? GrazieCitazione:
HTTP/1.0 500 Can't connect to http://www.google.it:80 (Bad hostname) Date: Sun, 13 Dec 2015 23:11:37 GMT Server: Apache Content-Type: text/plain Can't connect to http://www.google.it:80 (Bad hostname) LWP::Protocol::http::Socket: Bad hostname 'http://www.google.it' at /avsys/proxy/LWP/Protocol/http.pm line 51