Good day, there is currently such a php code for authorization:
<?php header('Content-Type: text/html; charset=utf-8'); setlocale(LC_TIME, "ru_RU.utf8"); $login_params = explode('=', file_get_contents('php://input')); auth(); function auth() { $auth_curl = curl_init(); curl_setopt_array($auth_curl, array( CURLOPT_URL => 'http://uapi.ucoz.com/index/sub/', CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_HTTPHEADER, array( 'Host: uapi.ucoz.com' ), CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query(array( 'user' => $login_params[0], 'password' => $login_params[1], 'a' => '2', 'ajax' => '2', 'api_request' => '1', 'api_login_rnd' => get_rand_str(), 'api_login_crc' => get_rand_str(), '_tp_' => 'xml' )) )); $response = curl_exec($auth_curl); curl_close($auth_curl); echo $response; } function get_rand_str() { $length = rand(8, 10) - 1; $num = rand(0,9); for($i = 0; $i < $length; $i++) { $num .= rand(0, 9); } return $num; } ?> A логин;пароль expected at the entrance, but the server always responds that the login or password is not correct. If you enter a specific login value instead of $login_params[0] , and instead of $login_params[1] specific password value, with the same ones that are sent via file_get_contents('php://input') , then the authorization is successful. As a result, the values are the same, but if you use the elements of the array, instead of the specific embedded values, the authorization will not be successful. What could be the problem?
authfunction, the value oflogin_paramsnot available. - u_mulderfunction auth($params) {....} auth($login_params);:function auth($params) {....} auth($login_params);- Boris