**>Date: Mon, 3 Jan 2005 19:56:32 -0800 (PST) **>From: Real World <[EMAIL PROTECTED]> **>Subject: Re: post-url **>To: Julien Buratto <[EMAIL PROTECTED]>, Kannel <[email protected]> **> **>thanx for the reply , let me ask some questions ? **>I have defined default service for post url . Normally i can send out sms via web browser. **> **>1. I need to specify a service for post url . do i have to write a script/code ? **>2. without writing any code cant i try with just a URL ? with help of Parameters (Escape Codes ) **> **>Actually still i cant get exact idea of POST URL . plz dont think , i'm bothering u all , plz help me **> **>thanx **> **> **>Julien Buratto <[EMAIL PROTECTED]> wrote: **>Real World wrote: **>> hi friends , **>> **>> i'm bit confused about post-url. can any body help or guide me to write **>> a php script to send sms via default service ? **>> This php script supposed to be a Post- URL . **>> **>> **> **>Try to fopen("http://your_kannel_host/page.cgi?variables","r") and print **>the chars you get back. **> **>J
Answer to Question 1) A post-url is part of the sms-service delcaration. This means that the HTTP_POST will occur when an MO SMS (SMS coming from an enduser sending an SMS to your service) reaches the smsbox. Assume that the user (phone number: +1 333 555 9876) created an SMS with the content: weather nyc He then sends the SMS to the phone number: +1 222 555 1234. When the message is sent to that phone number, it will be routed to your connection (maybe because the you have an agreement between you and the operator to forward the SMS to you OR maybe that number is associate with the SIM you are using inside the GSM modem you setup as a virtual SMSC). The SMS is sent to your bearerbox. The bearbox then forwards it to your smsbox. The smsbox will receive the SMS, notice that you have a default service set like this: group = sms-service name = myservice_via_post keyword = default catch-all = true post-url = "http://192.168.16.1/cgi-bin/sms-from-user" The smsbox will make an HTTP_POST to the host 192.168.16.1 and issue the following info to your HTTP server: POST /cgi-bin/sms-from-user HTTP/1.1 Host: 192.168.16.1:80 User-Agent: Kannel/1.4.0 Content-Type: text/plain X-Kannel-From: 1333559876 X-Kannel-Time: 2005-01-04 07:11:31 X-Kannel-Coding: 0 X-Kannel-Service: myservice_via_post Content-Length: 11 weather nyc Your application (sms-from-user) will be started by your HTTP server and receive the "weather nyc" as input. Your application can then perform the service associated with that request (get the weather condition for NYC) and write out the information back to your HTTP server. Your HTTP server will then send the information back via the established HTTP_POST connection between the HTTP server and the smsbox. The smsbox will take the text you send it, create an SMS out of it and generate an MT SMS (SMS going to a mobile device) targeted back to the +1 333 555 9876 phone number. The smsbox sends it to the bearerbox for delivery. The bearerbox receives the SMS and sends it to the Mobile Network Operator for final delivery to the mobile user. The user gets an SMS with the information he/she requested. Answer to Question 2) Instead of using post-url in your "group = sms-service" section, you can use the get-url declaration. In that case, you assume that the URL you specify can perform the service on your behave and generate the output that will be sent back to the user. Using the same scenario as before (get weather condition for NYC), you would have the following in your configuration: group = sms-service name = myservice_via_get keyword = default catch-all = true get-url = "http://192.168.16.1/cgi-bin/sms-from-user?city=%s" When the user sends the SMS, your smsbox will issue an HTTP_GET to your HTTP server like: GET /cgi-bin/sms-from-user?city=nyc HTTP/1.1 Host: 192.168.16.1:80 User-Agent: Kannel/1.4.0 Your HTTP Server will start the application (sms-from-user) and be given the argument: city=nyc The application will perform the service and hopefully output the results. The HTTP server will return the information back to the smsbox via the HTTP connection established from the HTTP_GET and smsbox will generate an MT SMS with the content and send it to the user. See ya... d.c.
