Results 1 to 4 of 4

Thread: HTTP Status Code 407 | Proxy Authentication Required

  1. #1

    Default HTTP Status Code 407 | Proxy Authentication Required

    Hi all.

    I am in the bad situation at I need to do proxy authentication to get access to http/https. PTS supports some kind of
    proxy configurations - proxy and port - but that is not enough for network environment.
    It would be great to add support for username and password to the current proxy support in PTS.

    To access the internet I need to provide Chrome a proxy URL which looks like:
    http://userassword@urlort

    Thanks
    ac

  2. #2

    Default

    Quote Originally Posted by austriancoder View Post
    Hi all.

    I am in the bad situation at I need to do proxy authentication to get access to http/https. PTS supports some kind of
    proxy configurations - proxy and port - but that is not enough for network environment.
    It would be great to add support for username and password to the current proxy support in PTS.

    To access the internet I need to provide Chrome a proxy URL which looks like:
    http://userassword@urlort

    Thanks
    ac

    Have you tried editing your system's php.ini file directly? I think it should offer such proxy configuration from there.

    -- Michael

  3. #3

    Default

    As PTS is using stream_context_create(..) the correct way to fix this would be something like:

    PHP Code:
    $auth base64_encode('LOGIN:PASSWORD');

    $aContext = array(
        
    'http' => array(
            
    'proxy' => 'tcp://192.168.0.2:3128',
            
    'request_fulluri' => true,
            
    'header' => "Proxy-Authorization: Basic $auth",
        ),
    );
    $cxContext stream_context_create($aContext);

    $sFile file_get_contents("http://www.google.com"False$cxContext);

    echo 
    $sFile
    see http://stackoverflow.com/questions/1...behind-a-proxy

  4. #4

    Default

    As PTS is using stream_context_create(..) the correct solution would be something like:

    PHP Code:
    $auth base64_encode('LOGIN:PASSWORD');

    $aContext = array(
        
    'http' => array(
            
    'proxy' => 'tcp://192.168.0.2:3128',
            
    'request_fulluri' => true,
            
    'header' => "Proxy-Authorization: Basic $auth",
        ),
    );
    $cxContext stream_context_create($aContext);

    $sFile file_get_contents("http://www.google.com"False$cxContext);

    echo 
    $sFile
    see http://stackoverflow.com/questions/1...behind-a-proxy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •