I am having trouble with this function. It works well with http but doesn’t return anything when using https. I am working on facebook’s url to fetch all public groups post.
function fetchUrl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$retData = curl_exec($ch);
curl_close($ch);
return $retData;
}
The only way I’ve seen is to scrape the url by simple php html dom parser and convert it into array. However, I feel there’s a better way, or could make some changes to this existing function. Where am I going wrong?
FYI: I have enabled openSSL in php.ini
Try adding these options
Quoting PHP Manual