Alıntı
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
eklediğimde xml dosyasını iki defa yazıyor normal boyu 1.4 mb iken 2.8 mblık bir dosya oluşturuyor.
<?
set_time_limit(0);
$data = "kod=xxx&kkod=xxx&sifre=xxx" ;
$ch = curl_init('https://www.bayinet.com.tr/bayi/security/loginrespond.asp');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd().'/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd().'/cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec ($ch);
curl_close ($ch);
$ch = curl_init('https://www.bayinet.com.tr/bayi/security/loginrespond.asp');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd().'/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd().'/cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, 'http://www.bayinet.com.tr/bayi/liste_genel_xml.asp');
ob_start();
curl_exec($ch);
$resultxml = ob_get_contents();
ob_clean();
curl_close ($ch);
$dosya = 'http://www.bayinet.com.tr/bayi/liste_genel_xml.asp';
$yenidosya = getcwd().'/genelliste.xml';
$handle = fopen($yenidosya,'a+');
fwrite($handle,$resultxml);
echo 'XML dosyası başarılı bir şekilde oluşturuldu...';
fclose($handle);
?>