My source code is running 100% good when it is only on my localhost (XAMPP) but when I upload it my source code doesn't curl the sites, it cannot also provide any output. By the way I only upload my sample site to Hostinger.
The issue is probably that curl is not enabled on your hosting server, you can see if that's the problem by using the phpinfo()
function and you will be displayed everything that is enabled.
If it's not contact your hosting or change it.
First, you have a missing }
in for
loop. But if it is just a typo, try to separate curl codes from your for
loop.
You can move them to a function like this:
...
$link=...
curl_call($link);
just checked your code, please add below lines at the end, you will come to know what is the error
if(curl_error($ch))
{
echo 'error:' . curl_error($ch);
}
else{
echo $content;
}
replace $ch
with $handle
and also remove init_set function as of now
Output is
error:Could not resolve host: wwww.todayhumor.co.kr
Please check and confirm the Url