Getting zipped XML files(accommodation.xml.zip) with curl PHP



I have used and tried below code for getting the xml file from FTP server, Actually that xml file is zipped as accommodation.xml.zip. So that I couldn't get that xml file using curl() in php



$url_method = "http://ift.tt/1BGdOE7";
$username = "test";
$pwd = "test";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_method);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$pwd");
$xmlcontent = gzdecode ( curl_exec($ch) );
curl_close($ch);
print_r($xmlcontent);


By using this code, I have got below error: ////////////////////////// Severity: Warning


Message: gzdecode(): data error


Filename: controllers/cron.php


Line Number: 438 /////////////////////////


But when I try to use the ftp url in browser, that zip file has downloaded.


Can anyone help me to get the xml file using curl() without error ?


No comments:

Post a Comment