Announcement

Collapse
No announcement yet.

HTTP Status Code 407 | Proxy Authentication Required

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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
    Michael Larabel
    https://www.michaellarabel.com/

    Comment


    • #3
      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

      Comment


      • #4
        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

        Comment

        Working...
        X