Send SMS via API

Its posible send sms from web form ?

this is the code i tried

<form name='f1' action='http://172.31.224.56/api/cmd.sms.sendMessage' method="POST">
	Address:<input type="text" name='address'><br>
	Content: <input type="text" name='content'><br>
	ConnId: <input type="text" name='connId'><br>
	<input type='submit' value='Send'>
</form>

response
{
“stat”: “fail”,
“code”: 401,
“message”: “Unauthorized”
}

some help ?

look at the api calls , you have to authenticate and store a token first before this call I believe.

thanks. i will search the token.

i change my code to use curl but still dont working

$client = curl_init();
	curl_setopt($client, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($client, CURLOPT_SSL_VERIFYHOST, 0);
	curl_setopt($client, CURLOPT_FOLLOWLOCATION, true);
	//curl_setopt($client, CURLOPT_HEADER, true);	
	curl_setopt($client, CURLOPT_URL, "http://172.31.224.56/api/login");		
	curl_setopt($client, CURLOPT_POST, 1);
	curl_setopt($client, CURLOPT_POSTFIELDS, "username=admin&password=XXXX");
	curl_setopt($client, CURLOPT_COOKIEJAR, "cookies.txt");
	curl_exec($client);
	

	curl_setopt($client, CURLOPT_URL, "http://172.31.224.56/api/cmd.sms.sendMessage");	
	curl_setopt($client, CURLOPT_POSTFIELDS, "address=+569978223&content=Test");
	
	curl_exec($client);
	curl_close($client)

response
{ “stat”: “ok”, “response”: { “permission”: { “GET”: 1, “POST”: 1 } } }
{ “stat”: “fail”, “code”: 400, “message”: “Wrong address format” }

Test something basic after login like getting cpu status does that work?

2 Likes

Phone number (address) format? Eg plus symbol, country code, full telephone number. Ex +19711234567 for an US based number.

Here you can find a sample test case using POSTMAN, described by sitloongs. Please try this first, and check if the address is correct.

Like @Jonathan_Pitts mentioned, try an api-function that does not need any parameter like api/info.firmware.

1 Like

thanks. solved.

2 Likes

SMSala robust and carrier-grade SMS platform that powers billions of messages. SMSala SMS API | Enterprise-grade secure platform to send-receive high-volume messages.