How get code error from request CURL php? -


i use code:

public function getpage($url, $post=false, $data=null){ //function auth         $this->refferer = $url;         curl_setopt($this->curl_obj, curlopt_url,$url);         if($post == true){             curl_setopt($this->curl_obj, curlopt_post, 1);             curl_setopt($this->curl_obj, curlopt_postfields, $data);         } else {             curl_setopt($this->curl_obj, curlopt_post, 0);         }         return curl_exec($this->curl_obj);     } 

this function returns false, why? how can find out cause?

you can use curl_error()

        print_r(curl_error($this->curl_obj)) ;         //print_r(curl_getinfo($this->curl_obj)) ;  // detailed information 

based on comment below. add these 2 options curl before execution warning: remove ssl warnings if middle man messes route

curl_setopt ($this->curl_obj, curlopt_ssl_verifyhost, 0); curl_setopt ($this->curl_obj, curlopt_ssl_verifypeer, 0);  

Comments