I am using Httpful PHP library from http://phphttpclient.com/ , here is my sample code :
$uri = "https://ideabiz.lk/apicall/token?grant_type=password&username=user&password=pwd&scope=PRODUCTION";
$response= \Httpful\Request::post($uri)
->sendsJson()
->addHeaders(array(
'Accept' => 'application/x-www-form-urlencoded',
'Authorization' => 'Basic b28yWTJqNjJoSDN4dHdHNXVkZHhhd2RjWEhrYTp0Zlp5UU1NVEJTcGZiSGFDWFJmQTFvWTJCb2dh',
))
->send();
echo $response;
But it doesn't return anything. (Body should be empty here.) I have tried even like this
$url = "https://ideabiz.lk/apicall/token";
$response = \Httpful\Request::post($url)
->sendsJson()
->authenticateWith('user', 'pwd')
->body('{
"grant_type":"password",
"scope":"PRODUCTION"
}')
->addHeaders(array(
'Accept' => 'application/x-www-form-urlencoded',
'Authorization' => 'Basic b28yWTJqNjJoSDN4dHdHNXVkZHhhd2RjWEhrYTp0Zlp5UU1NVEJTcGZiSGFDWFJmQTFvWTJCb2dh',
))
->send();
echo $response;
But, it returns nothing. What should I do ..?