Include of remote files fails

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
salto
Forum Commoner
Posts: 31
Joined: Thu Jul 04, 2002 7:50 am

Include of remote files fails

Post by salto »

PHP 4.3.2, Apache 2.0.47, windows XP Pro

PHP includes of remote files give an error on Apache 2.0.47, includes of local files no problem.
The problem with inclusion of remote files was supposedly solved with PHP 4.3.2, but still seems a problem on Apache 2.0.47.

Code: Select all

<?php include('http://www.somedomain.com/');  ?>
gives error
Failed opening 'http://www.somedomain.com/' for inclusion (include_path='.;c:\php4\pear')
(FYI http://www.somedomain.com is in real an existing domain and there is no c:\php4\pear - seems to be a default message)

Is there any setting I should look into? Any ideas/help most welcome!
Thanks for your attention.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

...

Post by kettle_drum »

Hmmm not sure if this works on windows. Try setting allow_url_fopen to true.

If you have no luck then use fopen.
salto
Forum Commoner
Posts: 31
Joined: Thu Jul 04, 2002 7:50 am

Post by salto »

Thanks, yes allow_url_fopen is true, fopen() does not work, readfile() only works for for example remote plain textfiles, not for http://www.somedomain.com, then I get this warning
php_network_getaddresses: gethostbyname failed
readfile("http://www.somedomain.com/") - Invalid argument
for fopen() I get
Wrong parameter count for fopen()
Post Reply