I am trying to call an API using CURL , and the supplier is only allowed x-www-form-urlencoded's content-type, but it responds XML with JSON within it.
However, in PHP's curl response, it will remove all xml tag. This is the respond I got :
{ "Description":"MERCEDES BENZ C 300 AMG LINE MY17 W205 FACELIFT 9 SP AUTOMATIC 9G TRONIC", "RegistrationYear":"2020", "CarMake":{ "CurrentTextValue":"MERCEDES BENZ" }, "CarModel":{ "CurrentTextValue":"C" }, "MakeDescription":{ "CurrentTextValue":"MERCEDES BENZ" }, "ModelDescription":{ "CurrentTextValue":"C" }, "Seats":"5", "Body":"SEDAN", } The registered car is a MERCEDES BENZ C 300 AMG
The problem is at last "sentence" where it is not a valid json string, is there any way to remove unwanted "sentence" after the last } i.e. the "The registered car is a MERCEDES BENZ C 300 AMG"
any idea???
source https://stackoverflow.com/questions/67766503/invalid-json-response-with-api-curl-php
Comments
Post a Comment