I have a very weird case as follows :
This my CURL function :
function get_data($url) {
$ch = curl_init();
$timeout = 500;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
I have a txt file content link line by line. I get all that link to an array and tried to get content :
$itemLink = file($LinkFile);
if(empty($itemLink)){
echo "endFile";
exit();
}
echo $itemLink[0]; //https://stackoverflow.com
echo get_data($itemLink[0]);
The result return empty but when i tried put direct link to my function like this :
echo get_data('https://stackoverflow.com');
Of course i can get full page normally.
Anybody knows what going on ?