Alex wood
Alex wood

Reputation: 163

Php curl output blank in my case

<?php


// 1. initialize
$ch = curl_init();

// 2. set the options, including the url
curl_setopt($ch, CURLOPT_URL, "https://somesite.edu");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);

// 3. execute and fetch the resulting HTML output
$output = curl_exec($ch);

echo $output;

// 4. free up the curl handle
curl_close($ch);

?>

I use npm curl and it did retrieved something but when I try in php it return blank. What's my problem? I already said CURLOPT_RETURNTRANSFER to true.

Upvotes: 1

Views: 76

Answers (1)

Kevin
Kevin

Reputation: 41885

Try to add another option on your curl:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

Upvotes: 1

Related Questions