cURL / Mailing Lists / curl-library / Single Mail

curl-library

30MB download limit

From: John Taylor <john_at_vetsurgeon.org.uk>
Date: Thu, 17 May 2007 10:08:10 +0100

I am attempting to back up our online mysql database. Unfortunately we
can only administer the db through phpmysqladmin, and so I have
constructed a script to log in and then export the db as an
uncompressed file (db.sql).

The script stops downloading at about the 30MB limit, leaving me with
an incomplete db.sql. db.sql always terminates at the same point,
regardless if I insert or delete a few db entries above it:

(1778, '2006-11-24', '14:34:34', 6874, 1, '', 0, 0, '1 tablet twice a
day. START SATURDAY'),

(1779, '2006-11-24', '14:49:33', 6320, 1, '', 0, 0, 'Apply one tube to
back of neck every 4 weeks')(1779, '2006-11-24', '14:49:33', 6320, 1,
'', 0, 0, 'Apply one tube to back of neck every 4 weeks')

The sql file when downloaded manually via a browser continues:

,

(1780, '2006-11-25', '09:11:10', 6897, 1, '', 0, 0, 'Apply twice a day
for 7 days to affected area. WEAR GLOVES'),

help please!!

John

the script:

<?

set_time_limit(600);
$ch = curl_init();
curl_setopt($ch, CURLOPT_IGNORE_CONTENT_LENGTH, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
curl_setopt($ch, CURLOPT_USERPWD,'xxxx:xxxxxxxxxxxxxx');
curl_setopt($ch, CURLOPT_TIMEOUT, 600);
curl_setopt($ch, CURLOPT_URL,'http://xxxxxxx/phpMyAdmin/server_export.php');

$r = curl_exec($ch);
#find vars phpmyadmin requires in url
preg_match("#token=([a-z0-9]*?)\&#",$r,$t);
preg_match("#phpMyAdmin=(.*?)\"#",$r,$p);

$target ='http://xxxxxxx/phpMyAdmin/export.php?phpMyAdmin='.$p[1].'&lang=en-utf-8&convcharset=iso-8859-1&collation_connection=utf8_unicode_ci&token='.$t[1].'&export_type=server&phpMyAdmin='.$p[1].'&phpMyAdmin='.$p[1].'&db_select%5B%5D=xxxxxxxx&what=sql&phpMyAdmin='.$p[1].'&header_comment=&sql_compat=NONE&phpMyAdmin='.$p[1].'&phpMyAdmin='.$p[1].'&sql_structure=structure&sql_auto_increment=1&use_backquotes=1&phpMyAdmin='.$p[1].'&sql_data=data&showcolumns=yes&extended_ins=yes&max_query_size=50000&hexforbinary=yes&sql_type=insert&phpMyAdmin='.$p[1].'&latex_caption=yes&phpMyAdmin='.$p[1].'&latex_structure=structure&latex_structure_caption=Structure+of+table+__TABLE__&latex_structure_continued_caption=Structure+of+table+__TABLE__+%28continued%29&latex_structure_label=tab%3A__TABLE__-structure&phpMyAdmin='.$p[1].'&latex_data=data&latex_showcolumns=yes&latex_data_caption=Content+of+table+__TABLE__&latex_data_continued_caption=Content+of+table+__TABLE__+%28continued%29&latex_data_lab!
 el=tab%3A__TABLE__-data&latex_replace_null=%5Ctextit%7BNULL%7D&phpMyAdmin='.$p[1].'&csv_data=csv_data&export_separator=%3B&enclosed=%22&escaped=%5C&add_character=%5Cr%5Cn&csv_replace_null=NULL&phpMyAdmin='.$p[1].'&excel_data=excel_data&excel_replace_null=NULL&excel_edition=win&phpMyAdmin='.$p[1].'&htmlexcel_data=htmlexcel_data&htmlexcel_replace_null=NULL&phpMyAdmin='.$p[1].'&htmlword_structure=structure&phpMyAdmin='.$p[1].'&htmlword_data=data&htmlword_replace_null=NULL&phpMyAdmin='.$p[1].'&pdf_data=pdf_data&pdf_report_title=&phpMyAdmin='.$p[1].'&xml_data=xml_data&phpMyAdmin='.$p[1].'&asfile=sendit&filename_template=__SERVER__&remember_template=on&compression=none&phpMyAdmin='.$p[1];

curl_setopt($ch, CURLOPT_URL, $target);
$f=fopen('/home/xxxxx/public_html/xxxxxxx/db.sql','w');
curl_setopt($ch, CURLOPT_FILE, $f);
$r = curl_exec($ch);

curl_close($ch);

fclose($f);

?>
Received on 2007-05-17