PHP with timeout

Questions about hostip.info remote GET support.

Moderator: Moderators

PHP with timeout

Postby jimbo on Sat Mar 04, 2006 7:36 am

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.
jimbo
n00b
 
Posts: 1
Joined: Sat Mar 04, 2006 7:22 am

Postby Mister on Mon Mar 20, 2006 6:40 am

Try to use
Code: Select all
fsockopen($host, 80, $errno, $errstr, 2);

in your code
http://se.php.net/manual/sv/function.fsockopen.php
<?
echo "Creating GE-GEOIP";
echo "Using hostip.info db :-)";
?>
Mister
n00b
 
Posts: 14
Joined: Sun Mar 19, 2006 2:40 pm
Location: SE

Postby Brian121 on Mon Jan 29, 2007 12:45 am

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..
Brian121
n00b
 
Posts: 1
Joined: Sun Jan 28, 2007 11:19 pm


Return to Hostip.info remote GET/PHP support

Who is online

Users browsing this forum: No registered users and 4 guests

cron