1

I am trying to call CURL to another localhost project using yii. But in returns Couldn't resolve host

However, if I CURL other projects, it works fine. Is there any setting I need to update in the project I want to use CURL?

Here is my code:

 $ch = curl_init("https://test.localhost");   
 curl_setopt( $ch, CURLOPT_AUTOREFERER, TRUE );
 curl_setopt( $ch, CURLOPT_HEADER, 0 );
 curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );

 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);

 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

 $data = curl_exec($ch);
 if(curl_exec($ch) === false)
 {
   echo 'Curl error: ' . curl_error($ch);
 }
 var_dump($data);
 exit;
Cristal
  • 492
  • 4
  • 21

0 Answers0