Help with sending credentials?

From: Date: Thu, 14 Oct 2010 20:45:33 +0000
Subject: Help with sending credentials?
Groups: php.general 
Request: Send a blank email to php-general+get-308725@lists.php.net to get a copy of this message
Gents - I'm trying to work with a major vendor's web service, but all my efforts are met with a 401 authentication error response. I can log in manually to this URL using these credentials through a browser, so I know the credentials are good. Unfortunately the support guys at the vendor don't see any problem with my code and have not been able to help. $url = "https://servername.com/script"; $ctx = stream_context_create(array('https' => array( 'timeout' => 10, 'header' => sprintf("Authorization: Basic %s\r\n", base64_encode("myUsername:myPassword")) ))); $result = file_get_contents($url, 0, $ctx); $http_response = explode(' ', $http_response_header[0]); $response_code = $http_response[1]; <<<=== This is evaluating to '401' Thanks.

« previous php.general (#308725) next »