extract($str) is what you're looking for. Takes an array and breaks it up into individual variables using the keys of the array as the variable names.
http://php.net/manual/en/function.extract.php
You send the request to the script that ajax would normally be submitting the login info to. It doesn't need to be an "ajax" request, unless they are specifically looking for the XMLHttpRequest header in which case you'd just need to add it to the CURL header to simulate an ajax request.
Something like:
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Requested-With: XMLHttpRequest", "Content-Type: application/json; charset=utf-8"));
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.