Forum Moderators: coopster
I'm just starting out with curl.
Problem is that i'm not sure about my curl code and not sure about my cookies and the format they are in.
Leaves me with a lot of possible problems:)
Below is my curl code. I'm not sure about the cookiefile part. My intention is to send the cookie so i get the correct html in temp.txt
Hope you can help me with this one problem.
Cheers,
Thierry
[codes]
<?php
$ch = curl_init("http://latest.files.filefront.com/");
$fp = fopen("temp.txt", "w");
print_r(curl_getinfo($ch));
echo "\n\ncURL error number:" .curl_errno($ch);
echo "\n\ncURL error:" . curl_error($ch);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
$cookie_new = fopen ("cookie_new.txt", "w");
curl_setopt ($ch, CURLOPT_COOKIEFILE, "$cookie_new");
curl_exec($ch);
curl_close($ch);
fclose($fp);
$handle = fopen("temp.txt", "rb");
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
fclose($cookie_new);
fclose($handle);
echo $contents;
[/codes]