Jump to content

[SOLVED] Severe Problem


d.shankar

Recommended Posts

I have a simple php CURL script that check for a website and displays its response code and prints its source..

 

Here is the code...

<?php
$url="www.yahoo.com";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch,CURLOPT_FAILONERROR,true);
$source = curl_exec($ch);
$httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
echo "<br>Response:".$httpCode." For ".$url."<br>";

echo $source;
curl_close($ch);
?>

 

The above code is 100% error free.

 

I am getting a response code of 200 for www.google.com and i get a response code of 302 for www.gmail.com

 

both seems to be a positive result and not a false positive.

 

Later i analysed that google runs in http whereas gmail runs in https.. thus i get different response codes !!

 

My main problem is " I am unable to capture the source from gmail.com whereas i can able to capture the source for any http protocol sites"

 

Please have a look !

:(

Link to comment
https://forums.phpfreaks.com/topic/65201-solved-severe-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.