Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.