I want to perform a post call with the use of an api. But after some changes I still get the same error and it doesn't get solved/
This is the code I use:
// init
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://staging-exact-integration.posios.com/PosServer/rest/registration/register');
curl_setopt($ch, CURLOPT_POST, 1);
// array fields var
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
'city' => 'Gent',
'company' => 'cedric resto',
'email' => 'cedric@tills.be',
'firstName' => 'Cedric',
'lastName' => 'De Weirt',
'locale' => 'Gent',
'number' => '33',
'password' => '1234',
'phone' => '0476612438',
'referer' => '13c435f9-084a-4e79-866f-8b9800e5c14f',
'street' => 'Testlaan',
'zip'=> '9000')));
// receive server response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
print $server_output;
// further processing
if (strpos($server_output,'201') == true)
{
// created
echo 'Created';
}
else
{
// catch the error(s)
echo 'Error Catch';
}
I constanly get this error:
HTTP ERROR 415
Problem accessing /PosServer/rest/registration/register. Reason:
Unsupported Media Type
Powered by Jetty://
How can I solve this?