The use of the ESP8266 in the world of IoT

User avatar
By salmanali11053
#52201 Hey guys,
I wanna know correct procedure of doing HTTP post on a given URL using ESP8266 libraries.

Consider this URL. It is used to send SMS from experttexing.com by simply filling the parameters in the URL.

[url]
https://www.experttexting.com/ExptRestA ... &type=text
[/url]

Can I know how to do HTTP POST using WiFiClient library as well as HTTPClient library.
Waiting for helpful reply :)
User avatar
By salmanali11053
#52210 I'm trying like this using WiFi client library...
Code: Select all      client.println("POST /exptapi/exptsms.asmx/SendSMS HTTP/1.1");
      client.println("Host: www.experttexting.com");
      client.println("Connection: close");
      client.println("Content-Type: application/x-www-form-urlencoded");
      client.print("Content-Length: ");
      client.println(sttr.length());
      client.println("\r\n");
      client.println(sttr);


This is how client prints..
Code: Select allPOST /exptapi/exptsms.asmx/SendSMS HTTP/1.1
Host: www.experttexting.com
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 94


UserID=USERNAME&PWD=PASS!&APIKEY=APIKEY&FROM=DEFAULT&TO=+17133028183&MSG=MsgFromESP
Server Response....
HTTP/1.1 301 Moved Permanently



I am always getting 301 Moved Permanently as Response.. Please Help..
Last edited by salmanali11053 on Fri Aug 05, 2016 1:27 pm, edited 1 time in total.
User avatar
By 8n1
#52227 Hi,

that's probably because the API only supports HTTPS connections.
[url]https://www.experttexting.com/appv2/documentation/index/
[/url]
Take a look at the HTTPSRequest example in the Arduino IDE and try modifying this.

Ps: I hope this aren't your real login credentials in the link you posted. Otherwise remove or change them quickly and change the password.
User avatar
By salmanali11053
#52258
8n1 wrote:Hi,

that's probably because the API only supports HTTPS connections.
[url]https://www.experttexting.com/appv2/documentation/index/
[/url]
Take a look at the HTTPSRequest example in the Arduino IDE and try modifying this.

Ps: I hope this aren't your real login credentials in the link you posted. Otherwise remove or change them quickly and change the password.


Thanks for your response bro. yup those aren't my real credentials. I'll try by using HTTPSRequest class :)