WAMP file_get_contents($url) problem

Discussion in 'PHP' started by huanghh, Mar 15, 2010.

  1. #1
    I'm testing file_get_contents on my WAMP laptop (Windows Vista Home), and tried to use it to get the contents of www.google.com, scripts are as below:
    However I got the following errors:
    The allow_url_fopen is on in the php.ini, and tried change the set_time_limit to bigger or less, still the same errors.

    What's wrong with the php.ini settings or wrong with the script?
     
    huanghh, Mar 15, 2010 IP
  2. phpmik

    phpmik Peon

    Messages:
    3
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    check the maximum_execution_time in your php.ini but also check the timeout value for your apache web server configuration file
     
    phpmik, Mar 15, 2010 IP
  3. viron86

    viron86 Active Member

    Messages:
    426
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #3
    open pnp.ini
    search max_execution_time
    set its value to anything in seconds
    if you want script to run for 30 min
    then set max_execution_time=1800
     
    viron86, Mar 15, 2010 IP
  4. huanghh

    huanghh Active Member

    Messages:
    89
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    I don't think max_execution_time is the problem, since I tried the set_time_limit function and set the time limit to different values. And also I don't think we need 2 minutes to connect to google. I tried several other urls, and still the same problem.

    Expert please help.
     
    huanghh, Mar 16, 2010 IP
  5. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #5
    file_get_contents(), requires its dependencies to be enabled, so it can function correctly, theirfore ensure that you have internet access.
     
    danx10, Mar 16, 2010 IP
  6. viron86

    viron86 Active Member

    Messages:
    426
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #6
    i also had similar problem and on setting the value of max_execution_time my problem got solved
     
    viron86, Mar 16, 2010 IP
  7. huanghh

    huanghh Active Member

    Messages:
    89
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #7
    Not the problem of max_execution_time, I tried set it as 1200, and still same problem.
     
    huanghh, Mar 17, 2010 IP
  8. SoftCloud

    SoftCloud Well-Known Member

    Messages:
    1,060
    Likes Received:
    28
    Best Answers:
    2
    Trophy Points:
    120
    #8
    I know it sounds silly, but on the off chance ... you don't have a firewall protecting your WAMP?
     
    SoftCloud, Mar 17, 2010 IP