Hi all,
I need help regarding following problem.
I'm getting HTTP get responses from a program(Kannel) periodically.
The HTTP is in the following format.
"http://localhost/sms.php?A=10&B=abc"
I want to know whether is it possible to get the values of A & B using a Java program (not JSP) as soon as I get the response. (This link can be change as I want. I mean it needs not to be sms.php)
Pls help me with this..
Thank you in advance!

Recommended Answers

All 5 Replies

How do you get the responses?
Are they String objects like the one in your example or are they HttpServletRequest, HttpServletResponse objects?

What you said about the JSP is irrelevant. You don't need a JSP to get the response. If they were, how you think you get the request from a sevlet?

What code do you have to get the response/request?

If you are getting the "response" then you also sent the "request" so you should already have "A and B".

You need to better explain your situation and your goal.

It is like this...
Im running the Kannel SMS gateway at a remote unix server on the network. Kannel will send a HTTP like
"http://192.153.0.20/sms.php?A=10&B=abc"
when it receive a SMS from a mobile phone. Here A means the phone number and B means the message. So I do not know these values. (192.153.0.20 means the IP of the computer Im using)
I can run a php script on this host as sms.php and retrieve the values of A and B easily.
But I want to know whether the same thing is possible with Java.
(may be using Sockets. i really don't know )

Of course, a Servlet/JSP. Or use JPCAP and try to write a sniffer (although C/C++ would be better for that). Even easier, however, is to read the access log of the gateway, as all "get" URL are logged there ("post" URLs, as well, but without the data, of course) Java is also for that overkill, though.

Edit: But what is it you really want to do? Are you simply trying to log what telephone number sent a message to the gateway?

Or are you trying to determine what telephone numbers the gateway is forwarding an SMS to (and the message itself)?

In both cases, look at the configuartion for the gateway, you can probably log the info somewhere, if it is not being logged already. But be very careful. There are probably all sorts of legal issues involved.

Thank you for the help...
Actually I am hoping to process the incoming messages and send a reply back to the user...
I decided to stay with PHP because it is very simple and I'm running out of time.. :)
I hope to try out your suggestions later...
Thnx...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.