0

I got a few links, some on rapidshare and some on other uploading hosts. I tried getting the source code with curl and file_get_contents and then search for "Deleted" or so but I was not able to get the source code on some hosts.

On some hosts curl is working and on other file_get_contents is working but most won't return source code.

Here is my code for curl:

function curl_download($Url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch,CURLOPT_VERBOSE,false);
   curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
   curl_setopt($ch,CURLOPT_SSLVERSION,3);
   curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
$output = curl_exec($ch);
curl_close($ch);
return $output;
Mogsdad
  • 44,709
  • 21
  • 151
  • 275

1 Answers1

0

Try adding following in your cURL code:


//after -- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);

Hope it works for you

Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
  • Still not working. I get the source code but it's not like the source code that I get if I open the site and look at the source code, it's different. I get this before the source code: HTTP/1.1 200 OK Cache-Control: private Content-Length: 7036 Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.5 X-AspNet-Version: 2.0.50727 Set-Cookie: – user1104615 Dec 19 '11 at 01:48