PHP: FOPEN issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Giorgio Sam
    New Member
    • Sep 2007
    • 2

    PHP: FOPEN issue

    Hello there,
    WEIRD...fopen couldn't open any http file while it's working fine with any local file.
    I've tried the following:
    _______________ _______________ _______________ ___________
    1.
    [code=php]
    $fp = fopen("D:\Softw are\\test.txt", "r");
    while($data = fgets($fp, 400))
    echo $data;
    #--> Result OK
    [/code]
    2.
    [code=php]
    $fp = fopen("http://www.google.fr", "r");
    while($data = fgets($fp, 400))
    echo $data;
    #--> Result: Warning: fopen() [function.fopen]: php_network_get addresses: gethostbyname failed in C:\wamp\www\hot elGlobe\hotels_ list4.php on line 4

    # Warning: fopen(http://www.google.fr) [function.fopen]: failed to open stream: No error in C:\wamp\www\hot elGlobe\hotels_ list4.php on line 4
    [/code]
    _______________ _______________ _______________ _______________ ___

    P.S: I've tried with PHP4 and PHP5 but in vain.Same result with file_get_conten ts().
    Please advise.
    Thx in advance!
    Configuration: Windows XP
    Internet Explorer 6.0
    Last edited by Atli; Sep 27 '07, 04:37 PM. Reason: Added [code] tags.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi Giorgio. Welcome to The Scripts!

    If you want to use fopen() to open an URL, the 'allow_fopen_ur l' directive of the php.ini configuration must be enabled. This can not be set using ini_set() for security reasons.

    Comment

    • Giorgio Sam
      New Member
      • Sep 2007
      • 2

      #3
      Hi Atli,
      Thanks for ur reply.
      This is 2 inform u that 'allow_fopen_ur l' is already set to enabled.
      I'm wondering if the cause comes from my proxy settings.
      How can I check it ?
      Any clues?

      BRs,

      Comment

      Working...