Jump to content

[SOLVED] PHP error


transparencia

Recommended Posts

I got this error on a code that used to work fine.

 

Warning: file_get_contents(http://api.hostip.info/country.php?ip=myip) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error in /home/account/public_html/index.php on line 63

 

Line 63 of index.php says:

$ip = ($_SERVER["REMOTE_ADDR"]);

 

What is wrong?

Link to comment
Share on other sites

I guess I misinterpreted what was meant when using "suppress".  As CV showed, you could suppress and then handle.  I assumed Boom.dk meant suppress and forget as he did not post any other solution.

 

And yes, I also imagined that a country check might be used for locale settings on the page or something.  But it was mainly the "supress and forget" assumption.

Link to comment
Share on other sites

Well, yeah. :P

 

@transparencia:

From what I can gather, you are trying to determine a user's location from his/her IP. I think the best approach to solve this problem is to have a local list of IP ranges and their matching countries rather than relying on a 3rd party.

 

The IP ranges can be obtained from a site like this one:

http://www.ipaddresslocation.org/

Link to comment
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.