PHP HttpRequest


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

Best Solution

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