Catch HTTP 200 OK | Search |
NowSMS Support Forums ⬆ NowSMS Support - SMS Issues ⬆ Archive through August 10, 2011 ⬆ |
◄ ► |
Author | Message | |||
Joan DIMKO New member Username: Jdimko Post Number: 5 Registered: 02-2011 |
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 |
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 |
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 |
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 |