Advertisement
Crecket

Untitled

Nov 18th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function curl($url, $decode = false) {
  3.     if($decode == true){
  4.         $url = urlencode($url);
  5.     }
  6.     $ch = curl_init();
  7.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  8.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  9.     curl_setopt($ch, CURLOPT_URL, $url);
  10.     $result=curl_exec($ch);
  11.     $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  12.     $data = array("content" => $result,"httpcode" => $httpCode, "url" => $url);
  13.     return $data;
  14. }
  15.  
  16. $data = curl('someurl.com');
  17.  
  18. $data['content']  // complete source
  19. $data['httpcode'] // response code
  20. $data['url'] // de url die opgevraagd is
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement