PHP HttpRequest

前端 未结 3 1662
無奈伤痛
無奈伤痛 2021-01-07 07:59

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 ren

3条回答
  •  别那么骄傲
    2021-01-07 08:22

    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
    }
    

提交回复
热议问题