Catch HTTP 200 OK

Catch HTTP 200 OK SearchSearch
Author Message
Joan DIMKO
New member
Username: Jdimko

Post Number: 5
Registered: 02-2011
Posted on Monday, April 18, 2011 - 05:04 pm:   

I want to catch HTTP 200 OK when the sms is accepted by nowsms for delivery.
I am using C# asp.net to send sms.

Please can you tell me how ?
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3112
Registered: 08-2008
Posted on Wednesday, April 20, 2011 - 12:47 am:   

Hi Joan.

I'm not sure I understand what you mean, can you explain in more detail what the event is that you want to catch?

I'm not sure if you want to parse the HTTP response from the NowSMS server to determine the message ID, or if you want to catch the transaction of the message being submitted upstream, or something else?

--
Des
NowSMS Support
Joan DIMKO
New member
Username: Jdimko

Post Number: 6
Registered: 02-2011
Posted on Wednesday, April 20, 2011 - 08:19 am:   

Hi,
I use the following to sent sms:
http://192.168.1.100:8806/Send%20Text%20Message.htm?PhoneNumber={0}&Text={1}&TO&SEND@@&PID=&DCS=&DestPort=&DelayUntil=&Submit=Submit
I want to catch the response from nowsms after the url is executed, because sometimes the host 192.168.1.100 is unreachable and the sms is not sent. So I want to catch this situation when the connection to that host is not possible so that I can try to send the sms later.

Please help me.

Best Regards,
Joan DIMKO
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3116
Registered: 08-2008
Posted on Wednesday, April 20, 2011 - 05:26 pm:   

Hi Joan,

I'm not a C# expert.

Are you using the code at the following link?

http://support.nowsms.com/discus/messages/485/21018.html

This line of code executes the HTTP request and retrieves the HTTP response:

HttpWebResponse httpResponse = (HttpWebResponse)(httpReq.GetResponse());

There may be other ways to parse httpResponse, but from some quick web searching, I see that you can easily convert it to a stream:

Stream httpResponseStream = httpResponse.GetResponseStream();

The HTTP status would be the first parts of the stream ...

HTTP/1.1 200 OK

If you want to convert the stream to a text string for parsing, there's a code sample here: http://www.csharp-station.com/HowTo/HttpWebFetch.aspx

--
Des
NowSMS Support