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!
A voir également:

3 réponses

oberion Messages postés 1253 Date d'inscription   Statut Membre Dernière intervention   248
 
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
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
oberion Messages postés 1253 Date d'inscription   Statut Membre Dernière intervention   248
 
No idea...
You should try with simplexml_load_file instead...
0
Giorgio
 
Hello all,
I think that's due to my proxy settings.
Any clues how can I check it ?

Thx,
0