Results 1 to 3 of 3

Thread: [SOLVED]Sending SMS by using QNetworkAccessManager, QNetworkRequest and GET function

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question [SOLVED]Sending SMS by using QNetworkAccessManager, QNetworkRequest and GET function

    Hello All,

    I am trying to make a simple GUI which allows me to send a simple HTTPS URL with parameters under the form of https://herp.derp.com/sms/sendtxt.php?username=this&password=that&number=012 3456789&message=Lolhai&sender=MrCloud

    I've confirmed that using the above URL in Firefox sends my txt through, so it's my GUI that's failing.

    I've tried QHttp and I've tried QNetworkAccessManager, but to no avail. I feel like I'm missing something really trivial, so after googling relentlessly for two days without finding the answer, I feel like I need to ask a question specific to my project.

    This is the code I've been trying to get to work:

    Qt Code:
    1. void hcode::pbSendClicked(){
    2. QNetworkAccessManager *nwam = new QNetworkAccessManager();
    3.  
    4. QNetworkRequest request(QUrl("https://herp.derp.com/sms/sendtxt.php"));
    5.  
    6.  
    7. QByteArray data;
    8. QUrl params;
    9.  
    10. params.addQueryItem("username", ui->le1U->text());
    11. params.addQueryItem("password", ui->le2P->text());
    12. params.addQueryItem("mobilenumber", ui->le4N->text());
    13. params.addQueryItem("message", ui->teText->toPlainText());
    14. params.addQueryItem("sender", ui->le3S->text());
    15. params.addQueryItem("messagetype", "Text" );
    16. data=params.encodedQuery();
    17.  
    18. nwam->post(request,data);
    19. }
    To copy to clipboard, switch view to plain text mode 

    Everything the URL needs is queried from lineEdits and textEdits.

    What am I missing?

    Thanks in advance.


    Regards,
    Mr_Cloud
    Last edited by Mr_Cloud; 19th April 2013 at 06:43.

Similar Threads

  1. QNetworkAccessManager post
    By januszmk in forum Newbie
    Replies: 2
    Last Post: 13th April 2012, 10:01
  2. QNetworkAccessManager.get(QNetworkRequest) not working.. :(
    By matthieunc in forum Qt Programming
    Replies: 4
    Last Post: 23rd July 2011, 14:18
  3. POST and QNetworkAccessManager
    By hakermania in forum Newbie
    Replies: 1
    Last Post: 13th February 2011, 01:05
  4. QNetworkAccessManager::post() never returns
    By danc81 in forum Qt Programming
    Replies: 2
    Last Post: 21st October 2009, 10:13
  5. Replies: 5
    Last Post: 20th January 2009, 15:11

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.