Page 1 of 1

PHP with timeout

PostPosted: Sat Mar 04, 2006 7:36 am
by jimbo
Hi folks,

I want to use this service, specifically using the http://api.hostip.info/get_html.php?ip=xxxx format. However, I want to be able to set a timeout in PHP so that if I don't get a response after say, 0.5s the PHP script gives up trying (so that display of the page is not excessively slowed down for the user). Can anyone tell me what the best way to implement this in PHP is?

Ta.

PostPosted: Mon Mar 20, 2006 6:40 am
by Mister
Try to use
Code: Select all
fsockopen($host, 80, $errno, $errstr, 2);

in your code
http://se.php.net/manual/sv/function.fsockopen.php

PostPosted: Mon Jan 29, 2007 12:45 am
by Brian121
Hi folks, I want an easy HTTP oriented API to locate IP addresses and Geocode. That;s why I attached this code In my ASP page.

"http://api.hostip.info/get_html.php?ip=12.215.42.19
Country: UNITED STATES (US)
City: Sugar Grove, IL

http://api.hostip.info/get_html.php?ip= ... ition=true
Country: UNITED STATES (US)
City: Sugar Grove, IL
Latitude: 41.7696
Longitude: -88.4588

http://api.hostip.info/?ip=12.215.42.19
[use the URL above for an example - XML too long to paste below]
"

But Now it's giving me 24746## Error. Plz tell me what to do..