3v4l.org

run code in 300+ PHP versions simultaneously
<?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); } ?>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/aoXqA:27 Stack trace: #0 /in/aoXqA(6): qiwi_post('https://qiwi.ru...', 'source=MENU&log...') #1 {main} thrown in /in/aoXqA on line 27
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.25
Fatal error: Call to undefined function curl_init() in /in/aoXqA on line 27
Process exited with code 255.

preferences:
206.45 ms | 402 KiB | 266 Q