Welcome to WebmasterWorld Guest from 54.145.44.134

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

cURL not giving accurate result.

     

amrish80

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

5+ Year Member



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.

jack13580

6:42 pm on May 6, 2013 (gmt 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"

brotherhood of LAN

7:24 pm on May 6, 2013 (gmt 0)

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



I think Jack's on the right path, BT (UK) were doing this and caused me some confusion when I first came across it.

swa66

8:36 pm on May 6, 2013 (gmt 0)

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



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]

jack13580

9:07 pm on May 6, 2013 (gmt 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...]

amrish80

7:22 am on May 7, 2013 (gmt 0)

5+ Year Member



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



Thanks

brotherhood of LAN

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

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



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