I am implementing a client to consume vtiger REST API and in the login process I manage to get it working with curl but not with Guzzle.
Guzzle code:
$postData = [
'operation' => 'login',
'username' => $userName,
'accessKey' => $generatedKey
];
$response = $client->post($url, [
'form_params' => $postData
]);
There is not actual Guzzle error or exception but is just that I am not being able to authenticate:
{"success":false,"error":{"code":"INVALID_AUTH_TOKEN","message":"Specified token is invalid or expired"}}
Curl version:
$curl = curl_init($service_url);
$curl_post_data = array(
'operation' => 'login',
'username' => $crm_username,
'accessKey' => md5($crm_token.$crm_useraccesskey),
);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
I prefer to use Guzzle but right now I have no clue why it dos not work in Guzzle but it does using curl. Any ideas?