Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $username = $_POST['email'];
- $password = $_POST['password']
- $userData = array("username" => $username, "password" => $password);
- $ch = curl_init("http://mage21.loc/rest/V1/integration/admin/token");
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));
- $token = curl_exec($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement