Problems: Receive API with Delphi

Home Forums iSMS Problems: Receive API with Delphi

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4967
    Kamran Rana
    Participant

    Hi
    I need to read the messages received in the modem.
    Am trying to use the receive api through http:
    Here is my Code in delphi using http component from nsoftware.
    After building up the data I execute through a button click
    and then move the data to a memo field for display.

    Have I got the syntax right for the postdata
    or am i missing something !. I get the following error:

    “151: HTTP Protocol Error. 501 Not Implemented’ when
    I click on the button to execute the code.

    The only thing that shows up in the memo is:
    “<HTML><HEAD><TITLE>501 Not Implemented</TITLE></HEAD><BODY><H1>501 Not
    Implemented</H1>POST to non-script is not supported in Boa.</BODY></HTML>”

    Any pointers would be helpful. Thank you

    The Delphi Source Code:

    procedure TSMSInBoxFrm.BitBtn1Click(Sender: TObject);
    var urldata: TStringList;
    xmlstring:String;
    begin
    urldata := TStringList.Create;
    xmlstring:=’XMLDATA=’+’%3C%3Fxml%20version%3D%221.0%22%20′;
    xmlstring:=xmlstring+’encoding%3D%22ISO-8859-1%22%3F%3E%0D%0A%3CMessageNotification%3E%0D%0A%3′;
    xmlstring:=xmlstring+’CModemNumber%3E%2B2%3A19525945092%3C%2FModemNumber%3E%0D%0A%3CSenderNumber%3E%2B919844895692%3C%2F’;
    xmlstring:=xmlstring+’SenderNumber%3E%0D%0A%3CDate%3E08%2F03%2F14%3C%2FDate%3E%0D%0A%3CTime%3E12%3A55%3A54%3C%2′;
    xmlstring:=xmlstring+’FTime%3E%0D%0A%3CMessage%3ETest%0D%0A%0D%3C%2FMessage%3E%0D%0A%3C%2FMessageNotification%3E%0D%0A’;
    urldata.Add(xmlstring);

    SMSDATAhttp.ContentType := ‘application/x-www-form-urlencoded’;

    Try
    SMSDATAhttp.PostData:=(urldata.Text);
    SMSDATAhttp.Post(‘http://192.168.2.1:80&#8217;);
    except on ipwime:Exception
    do begin
    ShowMessage(ipwime.Message);
    end;
    end;

    SMSInboxData.Text:=SMSDATAhttp.TransferredData;

    end;

    #5014
    Bryon Davis
    Moderator

    Hi Kamran,
    I’m not familiar with Delphi, but it appears that you’re trying to construct the response data, rather than the GET request for the data.

    You should be using recvmsg and querycount requests in Polling mode. In Polling mode the iSMS will only deliver received sms messages when requested with a recvmsg request. The querycount request will retrieve the number of entries that are available to retrieve with the recvmsg request.

    An example of a basic recvmsg request would be:

    http://192.168.2.1:81/recvmsg?user=admin&passwd=admin

    As a test, you could enter this in a web browser’s address bar and retrieve messages. You would need to change the IP address to match your iSMS, the port ( :81 ) to match the port set in HTTP API Configuration, and the password.

    Below is more information on the recvmsg request. The parameters in [] are optional and can be used to limit which messages are retrieved.

    GET /recvmsg?user=admin&passwd=admin[&count=][&from][&fdate=][&tdate=][&ftime=][&ttime=][&text=]
    Query options are only used with the recvmsg? Command:
    ● All options given within [] indicate that they are optional
    ● count – number of messages to be displayed
    ● If filter is not given, it gives count of ALL unread messages
    ● from – SMS from this mobile number
    ● fdate, tdate – SMS received during this date period (from fdate; to tdate)
    ● date format: yy/mm/dd
    ● ftime, ttime – SMS received during this time period (from ftime; to ttime)
    ● time format: hh:mm:ss
    ● text – SMS received matching this text completely

    Regards,
    Bryon

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.