XK8ER
asked on
request page using curl
hello there,
I am using curl for my forum to verify download links from free hosting services..
i am having trouble trying to verify a site that has cookie in order to verify if the file
exists or has been deleted.. if you dont accept cookies you will get the same page
even though the file doesnt exist.. but if you accept cookies the page will show file
does not exist. im trying to fix this code and make it work..
I am using curl for my forum to verify download links from free hosting services..
i am having trouble trying to verify a site that has cookie in order to verify if the file
exists or has been deleted.. if you dont accept cookies you will get the same page
even though the file doesnt exist.. but if you accept cookies the page will show file
does not exist. im trying to fix this code and make it work..
function curl($link, $post='0')
{
if($fgc == 1)
{
file_get_contents($link);
}
else
{
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_HEADER, 0);
if(eregi("megashares\.com" , $link))
{
curl_setopt($ch, CURLOPT_COOKIE, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($post != '0')
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
$page = curl_exec($ch);
echo $page;
return($page);
curl_close($ch);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.