Curl funktioniert nicht, Fehler: konnte keine Verbindung zum host

Ich bin mit curl Holen Sie sich das Wetter Informationen von einem bestimmten Standort api.wunderground.com und das Problem ist es funktioniert nicht. Ich habe versucht mit der file_get_contents-Funktion auch, aber seine nicht funktioniert entweder. Hier ist mein code für curl:

function get_web_page($url)
        {
            //echo "curl:url<pre>".$url."</pre><BR>";
        $options = array(
            CURLOPT_RETURNTRANSFER => true,     //return web page
            CURLOPT_HEADER         => false,    //don't return headers
            CURLOPT_FOLLOWLOCATION => true,     //follow redirects
            CURLOPT_ENCODING       => "",       //handle all encodings
            CURLOPT_USERAGENT      => "spider", //who am i
            CURLOPT_AUTOREFERER    => true,     //set referer on redirect
            CURLOPT_CONNECTTIMEOUT => 15,      //timeout on connect
            CURLOPT_TIMEOUT        => 15,      //timeout on response
            CURLOPT_MAXREDIRS      => 10,       //stop after 10 redirects
            CURLOPT_PROXY          => null,

        );                  

        $ch         = curl_init($url);
        curl_setopt_array( $ch, $options );
        $content    = curl_exec( $ch );
        $err        = curl_errno( $ch );
        $errmsg     = curl_error( $ch );
        $header     = curl_getinfo( $ch,CURLINFO_EFFECTIVE_URL );
        curl_close( $ch );

        $header['errno']   = $err;
        $header['errmsg']  = $errmsg;

        //change errmsg here to errno
        if ($errmsg)
        {
            echo "CURL:".$errmsg."<BR>";
        }
        return $content;
        }

        $url        =   "http://api.wunderground.com/api/67927f145c532a19/geolookup/conditions/q/uae/dubai.json";

        get_web_page($url);

Ich habe meine server-Einstellungen, curl ist aktiviert und der server ist über den port 80. Kann jemand mir dabei helfen ich bin aus Ideen heraus.

  • Was ist der Fehler, Was not working?
  • CURL:konnte keine Verbindung zu host zeigt seine diese Nachricht, die ich habe, die Suche durch alle Optionen und was meine Aufmerksamkeit erregte, ist, dass mein hosting ist die Verwendung von port 80, das ist, warum es nicht funktioniert
  • haben Sie meine aktualisierte Antwort?
  • ja ich überprüfen, aber es funktioniert immer noch nicht
  • Ich habe das gleiche Problem. Curl ist aktiviert, aber Fehler konnte keine Verbindung zum host. Jede Anregung ?
InformationsquelleAutor buttjee | 2013-03-05
Schreibe einen Kommentar