tags:

views:

120

answers:

5

I need to perform a HTTP GET from PHP.

More specifically, from within /index.php I need to get the content of /trac/ and /svn/, find the "ul" element and then render then inline on the index.php.

/trac and /svn are relative URLs and not filesystem folders. http://myserver/trac and http://myserver/svn

A: 

if you have to do it on the same server filesystem functions seem to be easier and more clear. (opendir, readdir, etc)

FooLman
A: 

/trac and /svn are relative URLs and not filesystem folders. http://myserver/trac and http://myserver/svn

Miguel Vitorino
+1  A: 

Have a look at file_get_contents - it can be used to open urls under some conditions as can some of the other filesystem functions:

A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename and List of Supported Protocols/Wrappers for a list of supported URL protocols.

Ken
+2  A: 

I suggest you have a look at...

BlaM
+5  A: 

The simplest way is file_get_contents().

$str = file_get_contents('http://myserver/svn/');

// Or, if you don't want to hardcode the server
$str = file_get_contents('http://' . $_SERVER['HTTP_HOST'] . '/svn/');

if ($str)
{
    // Find the ul
}
Greg