Reputation: 2626
The following code always echos false. Am I missing something?
$url = "https://www.google.nl/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if(curl_exec($ch)) {
echo "true";
}else{
echo "false";
}
Upvotes: 2
Views: 2754
Reputation: 68556
Add this cURL
param. That is because , Google runs on Secure HTTP.
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Upvotes: 2