Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize | SQLize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $userpass = [ "grant_type" => "password", "username" => "rooter", "password" => "retoor0907" ]; $login = curl_init(); curl_setopt($login, CURLOPT_URL, "https://a.onenetwork-system.xyz/api/admin/token"); curl_setopt($login, CURLOPT_HTTPHEADER, array( 'Accept: application/json', 'Content-Type: application/x-www-form-urlencoded' )); curl_setopt($login, CURLOPT_RETURNTRANSFER, true); curl_setopt($login, CURLOPT_POSTFIELDS, http_build_query([ 'grant_type' => 'password', 'username' => 'rooter', 'password' => 'retoor0907', 'scope' => '', 'client_id' => 'string', 'client_secret' => 'string' ])); // ✅ Run the CURL request $response = curl_exec($login); // ❌ Check for CURL errors if (curl_errno($login)) { echo "Curl error: " . curl_error($login); curl_close($login); exit; } curl_close($login); // ✅ Decode JSON response $logdata = json_decode($response, true); // ✅ Access token check if (isset($logdata["access_token"])) { echo "Access Token: " . $logdata["access_token"]; } else { echo "No access_token found.\n"; echo "Response:\n"; print_r($logdata); // For debugging } ?>
Copy Clear