Welcome to WebmasterWorld Guest from 54.162.60.75

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

cURL not giving accurate result.

     
8:01 am on May 6, 2013 (gmt 0)

New User

5+ Year Member

joined:July 8, 2009
posts: 12
votes: 0


hi
i have created the code to check the status of the url enter by the client which check the status is 200 or not, but i return 200 also whether url does not exist please help.
$url="Some url";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_exec($ch);
$retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $retcode;


Any help will be appreciated.
6:42 pm on May 6, 2013 (gmt 0)

New User

5+ Year Member

joined:June 17, 2011
posts: 7
votes: 0


same problem as me, this is why
(your internet provider) is probably your ISP and when the DNS lookup fails they are hijacking your request and returning their search page.
do a search on "NXDOMAIN response hijacking"
7:24 pm on May 6, 2013 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4864
votes: 13


I think Jack's on the right path, BT (UK) were doing this and caused me some confusion when I first came across it.
8:36 pm on May 6, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 7, 2003
posts:4783
votes: 0


If it's that, change your DNS servers to 8.8.8.8 and 8.8.4.4 (both are offered publicly by Google), if it goes away: it's your ISP trying to make money off of your typos.

[edited by: swa66 at 8:36 pm (utc) on May 6, 2013]

9:07 pm on May 6, 2013 (gmt 0)

New User

5+ Year Member

joined:June 17, 2011
posts: 7
votes: 0


If it's that, change your DNS servers to 8.8.8.8 and 8.8.4.4 (both are offered publicly by Google), if it goes away: it's your ISP trying to make money off of your typos.


that won't work because the isp's got smarter, check out this article
[hackercodex.com...]
7:22 am on May 7, 2013 (gmt 0)

New User

5+ Year Member

joined:July 8, 2009
posts: 12
votes: 0


hi
Thanks for your help.
Can i do the same job using socket programming, will it help to return correct result.



Thanks
12:14 pm on May 7, 2013 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4864
votes: 13


No. You should read up and understand the above RE: DNS to see why writing your functions using sockets doesn't make a difference.