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.
Asked
Active
Viewed 3,122 times
0
-
Please add details about your code, your server, and what exactly doesn't work... here, we can't guess... – Random Apr 13 '16 at 07:31
-
Possible duplicate of [Curl return false on hostinger server (curl enabled)](http://stackoverflow.com/questions/34929470/curl-return-false-on-hostinger-server-curl-enabled) – Ohgodwhy Apr 13 '16 at 07:31
-
1firstly check if your server is enabled with curl http://php.net/manual/en/function.phpinfo.php, if that is not the case then please check for error http://php.net/manual/en/function.curl-strerror.php – JiteshNK Apr 13 '16 at 07:35
-
I checked already and it is stated that the curl is enabled – wrines wr ines Apr 13 '16 at 07:51
-
but still my source code doesn't work. – wrines wr ines Apr 13 '16 at 07:54
-
@wrines wr ines checked for error ?? still issue is there, then please paste the code here. Without that its difficult to find the issue. – JiteshNK Apr 13 '16 at 07:59
-
sorry @user2314870 I am just only a beginner. but I try to catch the error using this code echo error_reporting(E_ALL); and it provides an output of 32759 – wrines wr ines Apr 13 '16 at 08:16
-
Am I correct? or Just doing a mess?. if i am wrong please give me the sample code to get the error message so that I can provide you the error. – wrines wr ines Apr 13 '16 at 08:20
-
@wrines wr ines just post the code below in answer please check and let me know if your query is resolved or not – JiteshNK Apr 13 '16 at 09:28
3 Answers
1
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

JiteshNK
- 428
- 2
- 11
-
@wrines wr ines there is some issue with url, try paste the same URL in browser you will come to know – JiteshNK Apr 13 '16 at 09:20
-
Thank you @user2314870 for your time but still I cannot find the answer. – wrines wr ines Apr 13 '16 at 09:55
-
@wrines wr ines the error says it can't resolve the URL your code is okay, there issue with the URL that you are passing within cURL – JiteshNK Apr 13 '16 at 10:36
0
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.

Vasil Rashkov
- 1,818
- 15
- 27
0
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);

Amir
- 4,089
- 4
- 16
- 28
-
sorry, It is just only a typographical error. but when I do what you are advising me still doesn't work – wrines wr ines Apr 13 '16 at 08:40