1
\$\begingroup\$

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?

+CPIN: READY 

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

\$\endgroup\$
  • \$\begingroup\$ Have you tried doing so via other computer ? \$\endgroup\$ – vvy Aug 16 '13 at 16:46
  • \$\begingroup\$ what exactly do you mean by other computer? \$\endgroup\$ – Caspian Aug 16 '13 at 16:47
  • \$\begingroup\$ 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. \$\endgroup\$ – PeterJ Aug 16 '13 at 16:49
  • \$\begingroup\$ 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. \$\endgroup\$ – vvy Aug 16 '13 at 16:50
  • \$\begingroup\$ 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 \$\endgroup\$ – Caspian Aug 16 '13 at 16:53
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.