|
|
|
| Здравствуйте. Пытаюсь CURL заставить авторизоваться на w.qiwi.com. При помощи Firebug вытащил HTTP запрос который браузер отправляет для авторизации:
POST /auth/login.action HTTP/1.1
Host: w.qiwi.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: https://w.qiwi.com/payment/main.action
Content-Length: 59
Cookie: __utma=55547245.556474754.1373117171.1373461357.1373620449.3; __utmz=55547245.1373117171.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); JSESSIONID=3C71637919B2AAEC4F49DCB97E5E3492.node-wb10.2; __utmb=55547245.14.10.1373620449; __utmc=55547245
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
|
Эмитировал запрос таким кодом:
function request( $sPath, $mPOST = null, $aOptions = array() ) {
static $sReferer = null;
$oCURL = curl_init( 'https://w.qiwi.com/'.$sPath );
curl_setopt_array( $oCURL, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_COOKIE => $this->sCookies,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0',
CURLOPT_REFERER => $sReferer,
CURLOPT_HEADER => array( 'X-Requested-With: XMLHttpRequest' )
) );
if( !is_null( $mPOST ) )
curl_setopt_array( $oCURL, array(
CURLOPT_POST => 'application/x-www-form-urlencoded',
CURLOPT_POSTFIELDS => is_array( $mPOST ) ? http_build_query( $mPOST ) : $mPOST,
) );
if( count( $aOptions ) )
curl_setopt_array( $oCURL, $aOptions );
$sResponse = curl_exec( $oCURL );
$sReferer = 'https://w.qiwi.com/'.$sPath;
if( $sResponse === false || curl_errno( $oCURL ) != 0 )
throw new Exception( curl_error( $oCURL ), curl_errno( $oCURL ) );
curl_close( $oCURL );
return $sResponse;
}
$sResponse = request(
'auth/login.action',
array(
'login' => '+'.$iPhone,
'password' => $sPassword,
'source' => 'MENU'
),
array(
CURLOPT_HEADER => true
)
);
|
В ответ ошибка HTTP Status 401 - Authentication Failed: This request requires HTTP authentication.
Что она значит и с чем может быть связано её происхождение? | |
|
|