AliYun SMS API return InvalidParamString.MalFormed error
When use AliYun SMS API send SMS, will return error 400 - InvalidParamString.MalFormed in chance, the explain in Error Code List is: The specified paramString is wrongly formed. So the problem is ParamString.
{ Analysis }
Let's check the ParamsString in Url.
// correct
%7B%22code%22%3A%22123456%22%7D
// error
%7B%22code%22%3A123456%7D
Let's use iTool to do online decode(http://itool.yiilib.com/#/t/urlEncode)
// correct
{"code":"123456"}
// error
{"code":123456}
{ Result }
So, the 123456 was encodeed as integer in json_encode. But standard JSON format need all element under "", so that's the problem. The reason why I got this error intermittent is because after save and load it from Database, it will be used as string.
Leave Comment