Search code examples
phpauthenticationhttp-authentication

CGI Authentication via PHP script?


I'm trying to find out if there is any way to auth into some CGI script. I want my script to fetch XML located over adress.com/admin.cgi?mode=viewxml but user auth is required, so website prompts me with HTTP Auth window and when I enter credentials mentioned page is viewable, so I can easily work with XML.


Solution

  • Use this syntax: http://user:password@hostname/path.

    $user = 'Stackoverflow';
    $password = 'Password';
    
    $url = "http://$user:$password@adress.com/admin.cgi?mode=viewxml