Mit dem folgenden Code bekomme ich keine Art von Fehler oder Inhalt.Keine Fehlermeldung oder Inhalt von cURL
Ich interessiere mich für Inhalt meiner Website http://www.aptamitra.in.
$cookie = tempnam ("/tmp", "CURLCOOKIE");
$ch = curl_init();
//$timeout = 5;
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1");
curl_setopt($ch, CURLOPT_URL, "http://www.aptamitra.in");
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); # required for https urls
//curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
//curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
//curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
$content = curl_exec($ch);
$response = curl_getinfo($ch);
var_dump($content);
echo "<pre>";
print_r($response); // iam getting response here.
curl_close ($ch);
Das Array, das ich var_dump($content)
print_r($response)
erhalten unter Verwendung unter
bool(false) Array ( [url] => http://www.aptamitra.in/ [content_type] => text/html; charset=UTF-8 [http_code] => 302 [header_size] => 4956 [request_size] => 4984 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 20 [total_time] => 0.452 [namelookup_time] => 0 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => 0 [upload_content_length] => -1 [starttransfer_time] => 0.124 [redirect_time] => 0.328 [redirect_url] => [primary_ip] => 127.0.0.1 [certinfo] => Array ( ) [primary_port] => 1080 [local_ip] => 127.0.0.1 [local_port] => 52230 )
gezeigt Ich weiß nicht, warum es keinen Inhalt.
Sie erhalten eine 302-Weiterleitung, daher kein Inhalt, aber Sie haben CURLOPT_FOLLOWLOCATION aktiviert, was dieser Weiterleitung folgen sollte. Rätselhaft! – jedifans
@ Sherif, ja bekomme ich nicht Inhalt oder Fehlermeldung – EaB
Echo curl_error ($ ch); Einfügen vor curl_exec(); und kenne den Fehler – JYoThI