[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PHP and fopen remote URL problems



Hi all

I'm not sure if this is the right list for this problem but it is specific to my
OpenBSD box.

In PHP I'm using a (PEAR) class to fetch RSS feeds but it fails on my OpenBSD
3.4 box.

A simple test is when I run the following script:

<?php
$fd = fopen( "http://www.php.net/";, "r" );
if (!$fd) {
    echo "Cannot open URL";
} else {
    while(!feof($fd)) {
        $buffer = fgets($fd, 4096);
        echo $buffer;
    }
    fclose( $fd );
}
?>

It throws the following error in error_log:

[Mon Feb 23 03:06:54 2004] [error] PHP Warning:  fopen():
php_network_getaddresses: getaddrinfo failed: non-recoverable failure in name
resolution in /htdocs/test.php on line 3

For everything else (ping, smtp mail, etc) name resolution works fine.  I'm
using djbdns if that makes much difference.

In my php.ini I have:
allow_url_fopen = On

When trying it with a file locally on disk it works, but clearly this is some
kind of name resolution issue.

I'm using PHP Version 4.3.3 from the ports tree, with a few standard extensions.

Has anyone came across this before, or does anyone have a solution.

Any help at all would be much appreciated.  If this is the wrong list to post
this message on, could someone please point me to the right one.

Thanks in advance.

--
Simon H