Advertisement
Guest User

_HttpRequest in PHP

a guest
Feb 10th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.85 KB | None | 0 0
  1. function _HttpRequest($link,$cookie='')
  2. {
  3.     $headers = array();
  4.     $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0';
  5.     $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
  6.     $headers[] = 'Accept-Language: en-US,en;q=0.5';
  7.     $headers[] = 'Connection: keep-alive';
  8.     if ($cookie != '')
  9.     $headers[] = 'Cookie: '.$cookie;
  10.     $headers[] = 'Cache-Control: max-age=0';
  11.     if($link != "")
  12.     {
  13.         $ch = curl_init();
  14.         curl_setopt ($ch, CURLOPT_URL, $link);
  15.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
  16.         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
  17.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  18.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19.         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  20.        
  21.         $page = curl_exec($ch);
  22.         curl_close($ch);
  23.        
  24.     }
  25.     return $page;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement