MarcoMartines / GSM-GPRS-GPS-Shield

GSM/GPRS & GPS Shield Library for modules using SIM900/SIM908
GNU General Public License v2.0
208 stars 152 forks source link

Clean HTLM result ("httpGETHTML") #12

Open mpena2099 opened 9 years ago

mpena2099 commented 9 years ago

Hi!

It is not an issue but an improvement. I'm trying to get a "clean" HTML (the page without the headers). If I run the GSM_GPRSLibrary_Client example it will return something like

......................................................

HTTP/1.0 200 OK
Date: Sat, 22 Nov 2014 18:57:10 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=3a222686aa17f6e6:FF=0:TM=1416682
630:LM=1416682630:S=w2GbmezulmVW3GZO; expires=Mon, 21-Nov-2016 X3OjREhJS9bNM4kGs2BzPS01l3iXFV85h-Ssmf7T39w3WMxx8NjPxp6Giam0RaDBhG2g0me5_C74NdqM37I-evSKfIY56b0; expires=Sun, 24-May-2015 18:57:10 GMT; path=/; domain=.google.com.br; HttpOnly
P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 80:quic,p=0.02

<html>
<body>
...
...
...
</html>

......................................................

And I just want the "<html>...</html>" stuff.

So, If I send the folowing AT sequence I get what I want:

AT+CGATT?
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","CMNET"
AT+SAPBR=1,1
AT+HTTPINIT
AT+HTTPPARA="URL","http://www.google.com"
AT+HTTPACTION=0
AT+HTTPREAD

Result: ......................................................

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com.br/?gfe_rd=cr&amp;ei=yNpwVMbPI4qk8weQk4GACA">here</A>.
</BODY></HTML>

OK

......................................................

So... how could I modify the lib to create a new "httpGETHTML" method? I'm not sure the best way to do this (and if there is not another way to do this).

Thanks!