Guest User

Untitled

a guest
Jul 22nd, 2014
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.61 KB | None | 0 0
  1. <?
  2. $username = 'user';
  3. $userpass = 'pass';
  4.  
  5. include('config.php');
  6. $url      = 'http://www.tvtorrents.com/login.do';
  7. $queryurl = 'http://www.tvtorrents.com/loggedin/search.do?search=%s';
  8. $PostData = array('posted'=>'true','username'=>$username,'password'=>$userpass,'cookie'=>'Y','submit'=>'&nbsp;LOGIN&nbsp;');
  9. $PostData = http_build_query($PostData);
  10.  
  11. $fscurl = curl_init();
  12. $headers = array
  13. (
  14.     'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*;q=0.8',
  15.     'Accept-Language: ru,en-us;q=0.7,en;q=0.3',
  16.     'Accept-Encoding: deflate',
  17.     'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7'
  18. );  
  19. curl_setopt($fscurl, CURLOPT_HTTPHEADER,$headers);
  20. curl_setopt($fscurl, CURLOPT_URL, $url);
  21. curl_setopt($fscurl, CURLOPT_FAILONERROR, 1);
  22. curl_setopt($fscurl, CURLOPT_REFERER, $url);
  23. curl_setopt($fscurl, CURLOPT_FOLLOWLOCATION, 1);
  24. curl_setopt($fscurl, CURLOPT_RETURNTRANSFER,1);
  25. curl_setopt($fscurl, CURLOPT_TIMEOUT, 20);
  26. curl_setopt($fscurl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.4) Gecko/2008102920 AdCentriaIM/1.7 Firefox/3.0.4');
  27. curl_setopt($fscurl, CURLOPT_POST, 1);
  28. curl_setopt($fscurl, CURLOPT_COOKIEJAR, 'cookie.txt');
  29. curl_setopt($fscurl, CURLOPT_COOKIEFILE, 'cookie.txt');
  30. curl_setopt($fscurl, CURLOPT_POSTFIELDS, $PostData);
  31.  
  32. curl_setopt($fscurl, CURLOPT_URL, sprintf($queryurl, urlencode($_GET['query'])));
  33.  
  34. $response = curl_exec($fscurl);
  35. $cut_start = stripos($response,"<body");
  36. $cut_end = stripos($response,"<h2>SEARCH");
  37. $response = substr($response,1,$cut_start).substr($response,$cut_end);
  38.  
  39. curl_close($fscurl);
  40.  
  41. echo $response;
  42.  
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment