PHP: FOPEN issue

Giorgio -  
 Giorgio -
Hello there,
I'm trying to parse XML files.
WEIRD...fopen couldn't open any http file while it's working fine with any local file.
I've tried the following:
________________________________________________________
1.
$fp = fopen("D:\Software\\test.txt","r");
while($data = fgets($fp, 400))
echo $data;
--> Result OK
2.
$fp = fopen("https://www.google.fr/?gws_rd=ssl","r");
while($data = fgets($fp, 400))
echo $data;
--> Result: Warning: fopen() [function.fopen]: php_network_getaddresses: gethostbyname failed in C:\wamp\www\hotelGlobe\hotels_list4.php on line 4

Warning: fopen(http://www.google.fr) [function.fopen]: failed to open stream: No error in C:\wamp\www\hotelGlobe\hotels_list4.php on line 4
_______________________________________________________________

P.S: I've tried with PHP4 and PHP5 but in vain.Same result with file_get_contents().
Please advise.
Thx in advance!
Configuration: Windows XP
Internet Explorer 6.0

3 réponses

  1. oberion Messages postés 1255 Statut Membre 249
     
    Hi,

    With php5, you don't need to use fopen. You can directly parse your xml file with the function simplexml_load_file.
    And it works fine !

    https://www.php.net/manual/en/function.simplexml-load-file.php

    If you want to do that with php4, you have to change something in the php.ini:
    allow_url_fopen = 1

    Enjoy !
    0
    1. Giorgio
       
      Hi
      thanks for ur swift reply.
      I've checked php.ini on both PHP4 and PHP5 and found out that allow_url_fopen = On.
      WEIRD...Any clues?

      BRs,
      0
  2. oberion Messages postés 1255 Statut Membre 249
     
    No idea...
    You should try with simplexml_load_file instead...
    0
  3. Giorgio
     
    Hello all,
    I think that's due to my proxy settings.
    Any clues how can I check it ?

    Thx,
    0