The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP file_get_contents timeout when loading facebook / google

Discussion in 'General Discussion' started by supersuphot, Feb 12, 2015.

  1. supersuphot

    supersuphot Registered

    Joined:
    Feb 12, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    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
     
  2. supersuphot

    supersuphot Registered

    Joined:
    Feb 12, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    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
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,743
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  4. supersuphot

    supersuphot Registered

    Joined:
    Feb 12, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    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
     
  5. supersuphot

    supersuphot Registered

    Joined:
    Feb 12, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I think what cause the problem is IPv4 , IPv6 stuff.
    I can't use wget for some domain that have IPV6 either (facebook, google)
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,743
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page