PHP file_get_contents timeout when loading facebook / google

supersuphot

Registered
Feb 12, 2015
4
0
1
cPanel Access Level
Root Administrator
Hi Threre,

My PHP can't use file_get_contents for some website (facebook/google,...) It can load data from other sites, but not this 2.

I google around and do all recommened method
- allow_url_fopen
- turn off firewall

But still not load these pages

Example Result
Code:
[B]Warning:[/B] file_get_contents(https://www.facebook.com/): failed to open stream: Connection timed out in /home/xxxxx/public_html/xxxxx/file.php on line 5
Have anyone have familar error? Any suggestion?

Thanks
 

supersuphot

Registered
Feb 12, 2015
4
0
1
cPanel Access Level
Root Administrator
Any suggestion please. It worked at first but a few days ago it not work anymore, I not change anything in cPanel. Also try rebuild PHP & Apache still not work

- - - Updated - - -

I wondering that just google and facebook are blocked from file_get_contents but all other site working fine. There is where that I should look into? that can block this kind of certain url.

Thanks
 

supersuphot

Registered
Feb 12, 2015
4
0
1
cPanel Access Level
Root Administrator
Hi cPanelMichael,

I think it not facebook TOS violates. I can still cURL the same url (https://www.facebook.com).
And the script is working for localhost and other host.

Code:
<?php
$result = file_get_contents('https://www.facebook.com/');
echo $result;
?>
Where should I investigate into? I try many method, really not have idea now.

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
I don't believe this issue is related to any settings or configurations associated with cPanel/WHM. However, feel free to open a support ticket using the link in my signature if you want us to verify that for you. You can post the ticket number here so we can update this thread with the outcome.

Thank you.