Web Hosting Info

Search:

featured partner

The IP to Country Database

  Forum Topics : Wish List / New Web Service at
Submitted by whooper on Thu, 04/08/2004 - 04:33.
It will be interesting to have a small utility script that tells us directly when was done the last modification of the CSV.ZIP file, something like


echo filemtime("/path/to/csv-file.zip");


Some will think to do that REMOTE, like


$URL ="http://ip-to-country.webhosting.info";
$fp = fsockopen($URL,80, $errno,$errstr,30);
if(!fp)
echo "$errstr($errno)\n";
else {
fputs($fp, "HEAD /path/to/csv-file.zip HTTP/1.0\r\n\r\n");
$match = array();
while(!feof($fp)) {
$line = fgets($fp,2280);
if (preg_match ('/^Last-Modified: (.+)$/i',$line,$match))
break;
}
fclose($fp);

if(count($match)>0)
$date = $match[1];
else
$date = " - unknown date - ";

// note that the time is GMT
echo $date."\n";
}


.. but in this case they'll need the /path/to/csv-file.zip thingie, which is actually unknown from afar'

There is another way, to parse directly the download page and extract the date from there .. but this will lead to some uneeded iNet trafic.

If that small script at the top can be implemented, please give us the link.

Thanks Alot!
Comment viewing options:
Select your preferred way to display the comments and click 'Save settings' to submit your changes.
Hi Whooper, You dont really
Posted by amit on Fri, 04/09/2004 - 05:11.
Hi Whooper,

You dont really need to Parse our website to get the last updated date of the CSV file, you can simply open a URLConnection to the CSV file and checked the last modified date.

eg. check out HTTP headers returned by http://www.delorie.com/web/headers.cgi?url=http%3A%2F%2Fip-to-country.webhosting.info%2Fdownloads%2Fip-to-country.csv.zip

I have written a small PHP script that parses the HTTP headers and displays the last updated timestamp
<?

function getRawHttpHeader($host,$doc)
{
   $httpheader = "";

   $fp = fsockopen ($host, 80, $errno, $errstr, 30);

   if (!$fp)
   {
      echo "$errstr ($errno) \n";
   }
   else
   {
      fputs ($fp, "GET $doc HTTP/1.0\r\nHost: " . $host. "\r\n\r\n");

      while (!feof($fp))
      {
       $httpresult = fgets ($fp,1024);
       $httpheader = $httpheader.$httpresult;
       if (ereg("^\r\n",$httpresult))
         break;
      }
      fclose ($fp);

   }

   return $httpheader;
}


function getArrayHttpHeader($url)
{
   $url = ereg_replace("http://","",$url);

   $endHostPos = strpos($url,"/");
   if (!$endHostPos)
      $endHostPos = strlen($url);

   $host = substr($url,0,$endHostPos);
   $doc = substr($url,$endHostPos,strlen($url)-$endHostPos);
   if ($doc=="")
      $doc = "/";

   $raw = getRawHttpHeader($host,$doc);
   $tmpArray = explode("\n",$raw);

   for ($i=0;$i<sizeof($tmpArray); $i++)
   {
      @list($name, $value) = explode(':', $tmpArray[$i], 2);
      $array[trim($name)]=trim($value);
   }

   return $array;
}


$array = (getArrayHttpHeader("http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip"));
// print_r($array);

// Display last updated timestamp
echo date("j F Y",strtotime($array['Last-Modified']));

?>
-
Amit Bhawnani
another humble employee.
 
Hello Amit, Thank you ver
Posted by whooper on Fri, 04/09/2004 - 09:19.
Hello Amit,

Thank you very much for your nice solution presented above. It seems that I need to review the HTTP RFC's .. and to implement a small script (running once a day), that sends me an email each time the CSV file is updated.

Thank you again,
whooper
 
ASP VBScript
Posted by bttoso com on Fri, 09/17/2004 - 13:11.
How can this be done in ASP VBScript? I've been trying with HTTP Headers but still don't know how to make it work.

Thanks
Skad
Posted by Jomas56 on Tue, 05/01/2007 - 01:13.
Merchendise this: pussy licking This was extreme pussy licking. fem dom strap on Valeria had fem dom strap on. hooters There are some hooters in the car. lesbian kissing This is long lesbian kissing. long nipples Her long nipples are very attractive. mature pussy Her mature pussy is sexy. huge boobs Huge boobs are good. big tit work She was big tit work yesterday. big school tit This is big school tit. teen sluts There few teen sluts in the room. teen ass Her teen ass was smooth. hot teen girl This hot teen girl is interesting. double anal Alan have double anal in last weekend. double penetration This was his double penetration. first anal She said: " first anal is pain". To be continued...