cURL command returning “false” in PHP

  Kiến thức lập trình

cURL command:

$curl = curl_init('https://path/to/api');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$deviceRes = curl_exec($curl);
curl_close($curl);

I have a script that calls a local API. If I copy and paste the link from PHP into my browser, it works fine, but when I call the PHP script, it reutrns false.

LEAVE A COMMENT