Advertisement
Guest User

Untitled

a guest
May 19th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public function get_curl_handle_for_request($method, $params) {
  2. list($get, $post) = $this->finalize_params($method, $params);
  3. $post_string = $this->create_url_string($post);
  4. $get_string = $this->create_url_string($get);
  5. $url_with_get = $this->server_addr . '?' . $get_string;
  6.  
  7. $useragent = 'Facebook API PHP5 Client 1.1 (curl) ' . phpversion();
  8. $ch = curl_init();
  9. curl_setopt($ch, CURLOPT_URL, $url_with_get);
  10. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
  11. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  12. curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  13. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
  14. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  15.  
  16. return $ch;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement