3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $qiwi_login = '+79099127277'; $qiwi_password = '1234'; // Авторизация, шаг 1 $qiwi_auth = qiwi_post('https://qiwi.ru/auth/login.action', 'source=MENU&login='.urlencode($qiwi_login).'&password='.urlencode($qiwi_password)); $qiwi_auth = json_decode($qiwi_auth['content'], true); $qiwi_token = $qiwi_auth['data']['token']; echo '<pre>'; echo print_r($qiwi_auth); echo '</pre>'; // Авторизация, шаг 2 $qiwi_auth = qiwi_post('https://qiwi.ru/auth/login.action', 'source=MENU&login='.urlencode($qiwi_login).'&password='.urlencode($qiwi_password)).'&loginToken='.urlencode($qiwi_token); function qiwi_post($url = null, $params = null, $cookie = null) { $headers = array( "Accept:application/json, text/javascript, */*; q=0.01", "Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4", "Content-Type:application/x-www-form-urlencoded; charset=UTF-8", "Connection:keep-alive", "X-Requested-With:XMLHttpRequest" ); $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_REFERER, 'https://qiwi.ru/'); if($params) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.80 (Windows NT 6.1; WOW64; U; pt) Presto/2.10.229 Version/11.62'); if($cookie) { curl_setopt($ch, CURLOPT_COOKIE, $cookie); } curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); $content = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE)); $header = substr($response, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE)); return array('content' => $content, 'header' => $header); curl_close($ch); } ?>