Shop OBEX P1 Docs P2 Docs Learn Events
Issue GSM for send a variable on a web page — Parallax Forums

Issue GSM for send a variable on a web page

JChrisJChris Posts: 58
edited 2016-05-31 22:59 in Propeller 1
Hi, I try to send a variable on a web page with the method "GET" but I don't understand why answers of my GSM don't match with answers that I should have.
I use the sim card "SIM5320" and a propeller C3

My code is:
CON
  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000

  GSM_Rx = 3
  GSM_Tx = 4
  GSM_Baud = 9600

  GPS_power = 5

VAR

  byte AT_Reponse[150], latitude[11], N_S[2], longitude[12], E_W[2], Date[6], UTCtime[10], altitude[10], vitesse[10], course[10], AmpI[10], AmpQ[10] 
  byte degre_lat[3], degre_minute_lat[3], degre_seconde_lat[7], resultat_latitude[15], degre_lon[3], degre_minute_lon[3], degre_seconde_lon[7], resultat_longitude[15] 
  byte date_jour[5], date_mois[5], date_annee[5], resultat_date[15], jour_local[5], date_local[15]
  byte char, ptr, ptr1, ptr2 

OBJ

  pst : "Parallax Serial Terminal"
  GSM : "FullDuplexSerial"
  Math : "Float32Full"

PUB main 

  pst.start(115200)
  Math.Start

  GSM.start(GSM_Rx, GSM_Tx, 0, GSM_Baud)
                                                                                    
  waitcnt(clkfreq*2+cnt)
  
'  Start_Module

  latitude[0] := "d"
  latitude[1] := "a"
  latitude[2] := "m"
  latitude[3] := "i"
  latitude[4] := "e"
  latitude[5] := "n"
  latitude[6] := 0   

  ptr := 0 
repeat                                             

  gsm.str(string("AT+CGSOCKCONT=1,",34,"IP",34,",",34,"m2minternet",34,13))  
  Rx

  pst.Str(String(13))  
  pst.str(String("La réponse à ta requete est la suivante 8: ",9))
  pst.Str(@AT_Reponse)
  pst.Str(String(13))

  waitcnt(clkfreq*2+cnt)

  gsm.str(string("AT+CSOCKAUTH=1,1,",34,"SFR",34,",",34,"SFR",34,13))  
  Rx

  pst.Str(String(13))  
  pst.str(String("La réponse à ta requete est la suivante 9: ",9))
  pst.Str(@AT_Reponse)
  pst.Str(String(13))

  waitcnt(clkfreq*3+cnt)
        
  gsm.str(string("AT+CHTTPACT=",34,"www.choupi.com",34,",80",13))  
  Rx
  
  pst.Str(String(13))  
  pst.str(String("La réponse à ta requete est la suivante 10: ",9))
  pst.Str(@AT_Reponse)
  pst.Str(String(13))

  waitcnt(clkfreq*3+cnt)

'  gsm.str(string("GET /index.php HTTP/1.1",26))
  gsm.str(string("GET /index.php? HTTP/1.1 "))
'  gsm.str(String("HTTP/1.1",13,10))  
  gsm.str(String("Host: www.choupi.com ",13,26))
'
'  gsm.str(String("www.smart-wine-cellar.com",13,10))                                    
'  gsm.str(String("User-Agent: MY WEB AGENT",13,10)) 
'  gsm.str(String("Content-Length: 0",13,10,13,10,26))

  Rx

  pst.Str(String(13))  
  pst.str(String("La réponse à ta requete est la suivante 11: ",9))
  pst.Str(@AT_Reponse)
  pst.Str(String(13))

  waitcnt(clkfreq*2+cnt)

  Rx

  pst.Str(String(13))  
  pst.str(String("La réponse à ta requete est la suivante 12: ",9))
  pst.Str(@AT_Reponse)
  pst.Str(String(13))

  waitcnt(clkfreq*2+cnt)

  Rx

  pst.Str(String(13))  
  pst.str(String("La réponse à ta requete est la suivante 13: ",9))
  pst.Str(@AT_Reponse)
  pst.Str(String(13))

  waitcnt(clkfreq*2+cnt)


PUB Rx

  Rx_GSM



Pub Rx_GSM  

    GSM.RxFlush
    repeat
      char := GSM.Rx
      pst.dec(char)
    while (char <> 10) 
    RxPacketNow_GSM

Pri RxPacketNow_GSM | valeur

    ptr := 0
    ptr1 := 0
    
    Repeat   
      char := GSM.Rx
      pst.dec(char)
      AT_Reponse[ptr++] := Char
    while Char <> 13
    
    AT_Reponse[--ptr] := 0

And I get this answer (image is attached)

The last line, I get as answer +CHTTPACT: 237 and I think that I should have : +CHTTPACT: DATA, (number of data).
Then I should have an other line that says that the communication is successful (+CHTTPACT:0)

If anyone has a hint, I would appreciate
921 x 266 - 15K

Comments

  • What do you get when you access the website via your browser??

    Is the url complete, to me it looks incomplete (missing some text after the ?):
    http://www.choupi.com/index.php?

    And trying to access it results in a 404 error
  • Sorry, I posted again my code because the URL of my website isn't good

    When I access the website via a browser, nothing changes even if I put a variable after the "?"

    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
      GSM_Rx = 3
      GSM_Tx = 4
      GSM_Baud = 9600
    
      GPS_power = 5
    
    VAR
    
      byte AT_Reponse[150], latitude[11], N_S[2], longitude[12], E_W[2], Date[6], UTCtime[10], altitude[10], vitesse[10], course[10], AmpI[10], AmpQ[10] 
      byte degre_lat[3], degre_minute_lat[3], degre_seconde_lat[7], resultat_latitude[15], degre_lon[3], degre_minute_lon[3], degre_seconde_lon[7], resultat_longitude[15] 
      byte date_jour[5], date_mois[5], date_annee[5], resultat_date[15], jour_local[5], date_local[15]
      byte char, ptr, ptr1, ptr2 
    
    OBJ
    
      pst : "Parallax Serial Terminal"
      GSM : "FullDuplexSerial"
      Math : "Float32Full"
    
    PUB main 
    
      pst.start(115200)
      Math.Start
    
      GSM.start(GSM_Rx, GSM_Tx, 0, GSM_Baud)
                                                                                        
      waitcnt(clkfreq*2+cnt)
      
    '  Start_Module
    
      latitude[0] := "d"
      latitude[1] := "a"
      latitude[2] := "m"
      latitude[3] := "i"
      latitude[4] := "e"
      latitude[5] := "n"
      latitude[6] := 0   
    
      ptr := 0 
    repeat                                             
    
      gsm.str(string("AT+CGSOCKCONT=1,",34,"IP",34,",",34,"m2minternet",34,13))  
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 8: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*2+cnt)
    
      gsm.str(string("AT+CSOCKAUTH=1,1,",34,"SFR",34,",",34,"SFR",34,13))  
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 9: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*3+cnt)
            
      gsm.str(string("AT+CHTTPACT=",34,"www.smart-wine-cellar.com",34,",80",13))  
      Rx
      
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 10: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*3+cnt)
    
    '  gsm.str(string("GET /index.php HTTP/1.1",26))
      gsm.str(string("GET /index.php?lat=12 HTTP/1.1 "))
    '  gsm.str(String("HTTP/1.1",13,10))  
      gsm.str(String("Host: www.smart-wine-cellar.com ",13,26))
    '
    '  gsm.str(String("www.smart-wine-cellar.com",13,10))                                    
    '  gsm.str(String("User-Agent: MY WEB AGENT",13,10)) 
    '  gsm.str(String("Content-Length: 0",13,10,13,10,26))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 11: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*2+cnt)
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 12: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*2+cnt)
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 13: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*2+cnt)
    
    
    PUB Rx
    
      Rx_GSM
    
    
    
    Pub Rx_GSM  
    
        GSM.RxFlush
        repeat
          char := GSM.Rx
          pst.dec(char)
        while (char <> 10) 
        RxPacketNow_GSM
    
    Pri RxPacketNow_GSM | valeur
    
        ptr := 0
        ptr1 := 0
        
        Repeat   
          char := GSM.Rx
          pst.dec(char)
          AT_Reponse[ptr++] := Char
        while Char <> 13
        
        AT_Reponse[--ptr] := 0
    
  • kwinnkwinn Posts: 8,697
    JChris wrote: »
    Sorry, I posted again my code because the URL of my website isn't good

    When I access the website via a browser, nothing changes even if I put a variable after the "?"

    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
      GSM_Rx = 3
      GSM_Tx = 4
      GSM_Baud = 9600
    
      GPS_power = 5
    
    VAR
    
      byte AT_Reponse[150], latitude[11], N_S[2], longitude[12], E_W[2], Date[6], UTCtime[10], altitude[10], vitesse[10], course[10], AmpI[10], AmpQ[10] 
      byte degre_lat[3], degre_minute_lat[3], degre_seconde_lat[7], resultat_latitude[15], degre_lon[3], degre_minute_lon[3], degre_seconde_lon[7], resultat_longitude[15] 
      byte date_jour[5], date_mois[5], date_annee[5], resultat_date[15], jour_local[5], date_local[15]
      byte char, ptr, ptr1, ptr2 
    
    OBJ
    
      pst : "Parallax Serial Terminal"
      GSM : "FullDuplexSerial"
      Math : "Float32Full"
    
    PUB main 
    
      pst.start(115200)
      Math.Start
    
      GSM.start(GSM_Rx, GSM_Tx, 0, GSM_Baud)
                                                                                        
      waitcnt(clkfreq*2+cnt)
      
    '  Start_Module
    
      latitude[0] := "d"
      latitude[1] := "a"
      latitude[2] := "m"
      latitude[3] := "i"
      latitude[4] := "e"
      latitude[5] := "n"
      latitude[6] := 0   
    
      ptr := 0 
    repeat                                             
    
    gsm.str(string("AT+CGSOCKCONT=1,",34,"IP",34,",",34,"m2minternet",34,13))  
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 8: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*2+cnt)
    
      gsm.str(string("AT+CSOCKAUTH=1,1,",34,"SFR",34,",",34,"SFR",34,13))  
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 9: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*3+cnt)
            
      gsm.str(string("AT+CHTTPACT=",34,"www.smart-wine-cellar.com",34,",80",13))  
      Rx
      
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 10: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*3+cnt)
    
    '  gsm.str(string("GET /index.php HTTP/1.1",26))
      gsm.str(string("GET /index.php?lat=12 HTTP/1.1 "))
    '  gsm.str(String("HTTP/1.1",13,10))  
      gsm.str(String("Host: www.smart-wine-cellar.com ",13,26))
    '
    '  gsm.str(String("www.smart-wine-cellar.com",13,10))                                    
    '  gsm.str(String("User-Agent: MY WEB AGENT",13,10)) 
    '  gsm.str(String("Content-Length: 0",13,10,13,10,26))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 11: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*2+cnt)
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 12: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*2+cnt)
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 13: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      waitcnt(clkfreq*2+cnt)
    
    
    PUB Rx
    
      Rx_GSM
    
    
    
    Pub Rx_GSM  
    
        GSM.RxFlush
        repeat
          char := GSM.Rx
          pst.dec(char)
        while (char <> 10) 
        RxPacketNow_GSM
    
    Pri RxPacketNow_GSM | valeur
    
        ptr := 0
        ptr1 := 0
        
        Repeat   
          char := GSM.Rx
          pst.dec(char)
          AT_Reponse[ptr++] := Char
        while Char <> 13
        
        AT_Reponse[--ptr] := 0
    

    Could it be the comma before the closing quote ( "AT+CGSOCKCONT=1,",34, ) as in the repeat loop below?
    repeat                                             
    
      gsm.str(string("AT+CGSOCKCONT=1,",34,"IP",34,",",34,"m2minternet",34,13))  
      Rx
    
  • response 237 indicates a network error, might be that you do not have a valid data connection?

    check with
    gsm.str(String("AT+CPSI?",13))
    
    after the CSOCKAUTH command

    Anyway according to the HTTP application note (http://simcom.ee/documents/SIM5320/sim52xx_http_application_note_v0.02.pdf)
    you might want to try this (normally there would be no need for the host or content-length, but I'm not sure if the modem needs it)
      gsm.str(string("GET /index.php?lat=12 HTTP/1.1", 13,10))
      gsm.str(String("Host: www.smart-wine-cellar.com",13,10))
      gsm.str(String("Content-Length: 0",13,10,13,10,26))
    
  • JChris,
    I little off topic, but it would be interesting if you could post details of your GSM interface module and circuit.
    Many thanks.
  • JChrisJChris Posts: 58
    edited 2016-06-27 22:39
    Hi, I don't understand why we put CR and LF at the end of request and why we have to put "CR" and "LF" twice before "Ctrl Z" because the datasheet don't mention that.

    Firstly, if I take this three sentences :
    gsm.str(string("GET /index.php?lat=12 HTTP/1.1", 13,10))
    gsm.str(String("Host: www.smart-wine-cellar.com",13,10))
    gsm.str(String("Content-Length: 0",13,10,13,10,26))
    

    my code doesn't work fine but I have a good start.

    My complete code is the following:
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
      GSM_Rx = 3
      GSM_Tx = 4
      GSM_Baud = 9600
    
      GPS_power = 5
    
    VAR
    
      byte AT_Reponse[150], latitude[11], N_S[2], longitude[12], E_W[2], Date[6], UTCtime[10], altitude[10], vitesse[10], course[10], AmpI[10], AmpQ[10] 
      byte degre_lat[3], degre_minute_lat[3], degre_seconde_lat[7], resultat_latitude[15], degre_lon[3], degre_minute_lon[3], degre_seconde_lon[7], resultat_longitude[15] 
      byte date_jour[5], date_mois[5], date_annee[5], resultat_date[15], jour_local[5], date_local[15]
      byte char, ptr, ptr1, ptr2 
    
    OBJ
    
      pst : "Parallax Serial Terminal"
      GSM : "FullDuplexSerial"
      Math : "Float32Full"
    
    PUB main 
    
      pst.start(115200)
      Math.Start
    
      GSM.start(GSM_Rx, GSM_Tx, 0, GSM_Baud)
                                                                                        
      waitcnt(clkfreq*2+cnt)
      
    '  Start_Module
    
      latitude[0] := "d"
      latitude[1] := "a"
      latitude[2] := "m"
      latitude[3] := "i"
      latitude[4] := "e"
      latitude[5] := "n"
      latitude[6] := 0   
    
      ptr := 0 
    repeat
      
      gsm.str(string("AT+CGSOCKCONT=1,",34,"IP",34,",",34,"m2minternet",34,13))  
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 8: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      gsm.str(string("AT+CSOCKAUTH=1,1,",34,"SFR",34,",",34,"SFR",34,13))  
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 9: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
            
      gsm.str(string("AT+CHTTPACT=",34,"www.smart-wine-cellar.com",34,",80",13))  
      Rx
      
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 10: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      gsm.str(string("GET /index.php?lat="))
      gsm.str(@latitude) 
      gsm.str(string(" "))
      gsm.str(string("HTTP/1.1", 13,10))
      gsm.str(String("Host: www.smart-wine-cellar.com",13,10)) 
      gsm.str(String("Content-Length: 0",13,10,13,10,26))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 11: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 12: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 13: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 14: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 15: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 16: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 17: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 18: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 19: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 20: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 21: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))
    
      Rx
    
      pst.Str(String(13))  
      pst.str(String("La réponse à ta requete est la suivante 22: ",9))
      pst.Str(@AT_Reponse)
      pst.Str(String(13))   
    
    

    And my answers are attached (the first loop is the image "Answers1" and the second loop is "Answers2")
    Two answers are different, I don't understand why

    Secondly, I haven't got all steps that give the datasheet because I haven't got "OK" and "+CHTTPACT: DATA, (number of data)":(simcom.ee/documents/SIM5320/sim52xx_http_application_note_v0.02.pdf


    Therefore I don't think that it works fine because my URL doesn't change
    988 x 774 - 58K
    941 x 775 - 57K
  • rosco_pcrosco_pc Posts: 464
    edited 2016-06-02 18:02
    The CRLF at the end is because of the HTTP Specification:
    HTTP-message   = start-line
                          *( header-field CRLF )
                          CRLF
                          [ message-body ]
    

    And it is working as you get a response back on you request, just a bit different as described in the document
    +HTTPACT: REQUEST indicates that the request is handled
    Followed by the response data
    +HTTPACT: 0 indicates the end of the response

    Having a repeat loop ending when +HTTP:ACT: 0 is received will get you the complete HTTP response
  • Ok thank you for these answers.

    I am wondering if it is normal that my URL doesn't change when I send a variable with the "GET" method?
    gsm.str(string("GET /index.php?lat="))
    gsm.str(@latitude)
    gsm.str(string(" "))
    gsm.str(string("HTTP/1.1", 13,10))
    gsm.str(String("Host: www.smart-wine-cellar.com",13,10))
    gsm.str(String("Content-Length: 0",13,10,13,10,26))
    

    What is my variable that I want send on web page is in correct position in the frame?
  • lattitude is the variable that contains the string you place in the URL. In the code you attached it is set to 'damien'
    '  Start_Module
    
      latitude[0] := "d"
      latitude[1] := "a"
      latitude[2] := "m"
      latitude[3] := "i"
      latitude[4] := "e"
      latitude[5] := "n"
      latitude[6] := 0   
    
    

    So you need to change that in order to change it in your URL. I hope that is what you're asking?


    The response from the smart-wine-cellar seems to just echo back what you supply, so I'm not sure how useful it is (or it is just used for testing?)

    You'll need to parse the response in order to get the result coming back from smart-wine-cellar,which might be a bit difficult as spin is not very good at string handling. There is a string library in the obex, that might make life easier:
    http://obex.parallax.com/object/579

  • JChrisJChris Posts: 58
    edited 2016-06-08 15:10
    The web site "smart-wine-cellar" is for testing

    I would like to send the variable "latitude" on a web page for record this variable in a database.
    Is it possible? And how do I do if it is possible because I try to retrieve the variable for one week but without results.
    I already made a php script for retrieve the variable with "GET" method.
  • rosco_pcrosco_pc Posts: 464
    edited 2016-06-08 08:47
    JChris wrote: »
    I would like send the variable "latitude" on a web page for record this variable in a database.
    Is it possible?
    Of course that is possible :)

    JChris wrote: »
    And how do I do if it is possible because I try to retrieve the variable for one week but without results.
    I already do a php script for retrieve the variable with "GET" method.
    I would make the response to the retrieval simpler, no html for instance, just the latitude returned and some indication if it went wrong, like
    latitude: ERROR | value
    
    possible returns:
    latitude:ERROR
    latitude:1234
    

    That way parsing is easier and you could use something like this (not tested at all, and URL used is 'made up')
      gsm.str(string("GET /get_latitude.php HTTP/1.1", 13,10))
      gsm.str(String("Host: www.smart-wine-cellar.com",13,10)) 
      gsm.str(String("Content-Length: 0",13,10,13,10,26))
    
      found = False
      repeat 
        Rx                                              ' get response
        if not found                                    ' skip if we already found the data
          idx = 0                                       ' reset index
          ' check for response with latitude value
          repeat until byte[@AT_Reponse+idx] != byte[@resp_latitude+idx]
            idx++
          if idx == 9                                   ' found a response starting with "latitude:", copy the result
            repeat
              latitude[idx-9] = byte[@AT_Reponse+idx]
              idx++
            until byte[@AT_Response] == 0 ' end of response
            found = True  ' Indicate we found the data
      until strcomp(@AT_Response, @resp_end)            ' continue until all response data is read 
    
    DAT
      resp_latitude BYTE "latitude:",0
      resp_end      BYTE "+HTTPACT: 0",0
    
  • JChrisJChris Posts: 58
    edited 2016-06-08 15:29
    Sorry I think that I misspoke, I don't want retrieve the variable in spin but with the "PHP" script.

    So I want to send the variable with the propeller C3 by the "GET" method on a web page, which is www.smart-wine-cellar and retrieve this variable sent by the propeller with a PHP script ($latitude=$_GET;) for recording the variable in the database.

    I use $_GET in PHP script because I use "GET" method for sending of the variable in spin program
  • rosco_pcrosco_pc Posts: 464
    edited 2016-06-08 19:01
    Aah sorry, I may have misunderstood.
    In php the $_GET is an array so to read the latitude you would need this statement in PHP
    $latitude = $_GET["lat"];
    

    Make sure you 'clean/check' $latitude before you use/store it to prevent errors (like inserting links or SQL queries in the variable), unless you're 100% sure no one else has access to the website :)

    EDIT: see http://php.net/manual/en/reserved.variables.get.php
  • Thank you for your help, it works fine now.
    I sent a string variable whereas for record my variable into the database, my variable had to be a integer :)
Sign In or Register to comment.