file - PHP IP2Location Download Corrupt Using Copy -
file - PHP IP2Location Download Corrupt Using Copy -
i have setup php script download ip2location info monthly using php re-create function. below script runs fine , downloads file (the file size right too, around 15 mb):
include('auth/resources/funcs.inc.php'); copy('http://www.ip2location.com/download?productcode=db11litebin&login=myemail@host.com&password=mypassword', local_datafiles . '/ip/db11_'.date('d-m-y', time()).'.bin'); $myfile = local_datafiles . "/ip/active_db.txt"; $fh = fopen($myfile, 'w') or die(); $stringdata = 'db11_'.date('d-m-y', time()).'.bin'; fwrite($fh, $stringdata); fclose($fh); however whenever seek run ip2location php file shows these errors:
warning: unpack(): type v: not plenty input, need 4, have 0 in /path/to/file/ip2location.inc.php on line 376
i have tested ip2location.inc.php on ip database when manually download , works fine without errors. however, when download database through php using re-create function shows loads of errors makes me think somehow corrupting file. have tested re-create function on zip file located on server , worked fine without corruption. i'm not sure problem is, have ideas?
the file downloaded server .zip extension.
please unzip file csv or bin file first before query using ip2location php api.
php file url download copy
Comments
Post a Comment