# GSM/GPRS AT command - hitting a link

I am trying to target a specific page (script) on my webserver using a GPRS modem. I can hit my domain, and get a reply back but then when I am trying to call my script it just won't let me:

AT

OK
AT+CPIN?

OK

AT+SFUN=SID

+ICCID: 54646149798787496

AT+CSQ

+CSQ: 16,99

OK

AT+AIPDCONT=“wap.rogers.com"

OK

AT+AIPA=1

+AIPA: 1,10.110.234.135,0,0,0 ;Connect with APN server

OK

AT+AIPO=1,,“www.Myserver.com”,80,0,,1

+AIPO: 1,“10.110.234.135”,4770,“74.125.227.17”,80,0,30,1,0,64000,8,7300,5720,-500,0)

OK


I am trying to hit either "MYSRVR.COM/SUB/PAGE.PY" or I can even do with "MYSRVR.COM/SUB/" if that's too much of a hassle.

Ref to AT commands/Data sheet

• Have you tried doing so via other computer ? – vvy Aug 16 '13 at 16:46
• what exactly do you mean by other computer? – Caspian Aug 16 '13 at 16:47
• The question is OK here IMO but something you should add is the kind of GPRS modem and a link to a datasheet or command documentation, the AT commands used for TCP/IP level comms tends to vary a bit. – PeterJ Aug 16 '13 at 16:49
• You say "I can hit my domain and get a reply back", I assume you did that via some other computer in your LAN( by pointing your browser to 'the' url). Can you similarly evoke your page.py script using this method ? That will reveal errors, if any. – vvy Aug 16 '13 at 16:50
• Well the reason that I am saying it works ok is the AT's respond on the 3rd line. but to answer your question, yes, I have tested the server and the script and it works OK on a browser, but I believe there is a different technique to opening a page via AT – Caspian Aug 16 '13 at 16:53

You're opening the socket OK but the part you're missing is that you'll need to issue an HTTP request to the server. The full documentation you'll probably want to look at is RFC2616 but the request should look roughly like this:

GET /SUB/PAGE.PY HTTP/1.1
Host: www.MYSERVR.com
(blank line)


The above probably violates a few standards because there are additional headers I believe you should include, but it should give you a pointer in the right direction. Maybe for a start install a Telnet client and try connecting that way rather than using a web browser so you can check that the request works OK and easily check the response you get back.

You need to send the above over the socket, so for that module take a look at AT+AIPW command.

I think you need to send a Http GET header after you are connected to the server. Something like

At+AIPW=1, "GET /SUB/ HTTP/1.1 \r\n Host: www.YOURSERVR.com \r\n User-Agent: Myzilla \r\n \r\n "


The datasheet you mentioned suggests one other method too i.e.

AT+AIPW=1,x
..response "CONNECT"
"x bytes of data"


Those x bytes should have a valid GET/POST header.

The server response shall follow the last step.

• yeah this sounds more reasonable. I'll give this a try – Caspian Aug 16 '13 at 18:04