Possible Duplicate:
How to avoid echo in curl_exec()?
I’m parsing an XML file that needs authentication.
Everything goes fine, the file is downloaded correctly, but the content of the XML authentication file is printed on the html page. How can I avoid this behavior?
Here is the XML file
<maxi-xml>
<login>Login successful</login>
</maxi-xml>
And here is the cURL connection
$ch = curl_init();
$cookiefile = tempnam("tmp", "cookies");
curl_setopt($ch, CURLOPT_URL,"http://www.maxithlon.com/maxi-xml/login.php?user=$_SESSION[user]&scode=$_SESSION[password]");
curl_exec($ch);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
curl_exec($ch);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_URL, "http://www.maxithlon.com/maxi-xml/athletes.php?");
$fp = fopen('xml/'.$_SESSION[teamid].'_athletes.xml', 'w');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
Before curl_exec put this