I have a working command line curl command
curl -v -d '{"auth": {"passwordCredentials": {"username": "myusername", "password": "mypassword"}}}' -H 'Content-type: application/json' myurl
I am trying to write equivalent PHP curl command -
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, myurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
$data = array('json' => '{auth: {passwordCredentials : {username : myusername, password : mypassword }}}');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
echo $output;
I am having different response for both the calls. I have doubt about setting the json data correctly.
The document has moved here.
PHP response also is same but it is redirecting me to different url "https://dev-test01.servosity.com.lab/auth/login/?next=/admin/" which shows that in command line it gets authenticated but in PHP it is not getting authenticated and redirecting me to login page in place of profile page. Thanks – user3135240 Dec 25 '13 at 22:04