Page 1 of 1

PHP error

PostPosted: Thu Mar 15, 2007 1:21 am
by cameltoe47
I'm trying to get the contents of in the following PHP script:


I always get the following error:

Warning: file_get_contents( [function.file-get-contents]: failed to open stream: Permission denied in /[path]/lookup.php on line 3

What do I need to do? I've tried making the request with cUrl and even fsockopen and they all say "permission denied connecting to" or something similar.


PostPosted: Thu Mar 15, 2007 1:23 am
by cameltoe47's that php code:
Code: Select all
$ip = $_REQUEST["ip"];
echo file_get_contents("$ip");

Without the php tags, obviously.

Re: PHP error

PostPosted: Mon Feb 09, 2009 2:09 pm
by healingrooms
I'm not sure what is in that include file, but here is some PHP code that will get the latitude, longitude, city, state and country from

Code: Select all
      function StripTags_IP($string){
         while(strstr($string, '>')){
            $currentBeg = strpos($string, '<');
            $currentEnd = strpos($string, '>');
            $tmpStringBeg = @substr($string, 0, $currentBeg);
            $tmpStringEnd = @substr($string, $currentEnd + 1, strlen($string));
            $string = $tmpStringBeg.$tmpStringEnd;
         return $string;
      function GetCountry_IP($IP){
         $lines = @StripTags_IP(file(''.$IP));
         return substr($lines[0], 9);
      function GetCity_IP($IP){
         $lines = @StripTags_IP(file(''.$IP));
         $pos = -(strlen($lines[1]) - strpos($lines[1], ','));
         return substr($lines[1], 6, $pos);
      function GetState_IP($IP){
         $lines = @StripTags_IP(file(''.$IP));
         $pos = strpos($lines[1], ',')+2;
         return substr($lines[1], $pos, 2);
      function GetLatitude_IP($IP){
         $lines = @StripTags_IP(file(''.$IP.'&position=true'));
         return substr($lines[2], 10);
      function GetLongitude_IP($IP){
         $lines = @StripTags_IP(file(''.$IP.'&position=true'));
         return substr($lines[3], 11);