Grazie Simo.
fsockopen(..)
sembra funzionare con siti con il protocollo http. Infatti la stringa che prende in input come Url deve iniziare senza http (poi viene aggiunta in automatico).
Ad esempio nel seguente codice (che funziona: chiama la pagina di google anche se questa dà un errore a me importa solo la chiamata) è preso quasi "paro paro" dalla documentazione ufficiale, nell'url manca il protocollo:
Vedo che la pagina di google viene richiamata. Se uso https per la mia paginacodice:$fp = fsockopen("www.google.it", 80, $errno, $errstr, 8); if (!$fp) { echo "$errstr ($errno) \n"; } else { $out = "GET / HTTP/1.1\r\n"; // questa ho provato a modificarla in "GET / HTTPS/1.1\r\n" per il sito https, ma senza gli effetti sperati $out .= "www.google.it\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp); }
ottengo:codice:$fp = fsockopen("https://ilserverBconIlDatabase.org/funzione.php?persona=Giacomo&anni=20", 80, $errno, $errstr, 8);
Unable to find the socket transport "https" - did you forget to enable it when you configured PHP? (-439920544)
---
Con function.file-get-contents ottengo l'errore di timeout:
... [function.file-get-contents]: failed to open stream: Connection timed out ...

Rispondi quotando