Shop OBEX P1 Docs P2 Docs Learn Events
WiFly sending URL arguments through serial terminal — Parallax Forums

WiFly sending URL arguments through serial terminal

BenjBenj Posts: 66
edited 2013-12-12 06:28 in Accessories
I am working my way through understanding how to retrieve a web page with my WiFly, but am having some difficulty in retrieving the page as expected. I haven't connected my prop yet and am just using the serial terminal. I am trying to connect to:

http://http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php

Here is what I've tried and my result.
CMD

<4.00> set ip proto 18
AOK
<4.00> set ip address 0
AOK
<4.00> set com remote GET$/weatherstation/updateweatherstation.php \n\n
AOK
<4.00> open weatherstation.wunderground.com 80
Connect to 38.102.137.157:80
<4.00> *OPEN*HTTP/1.0 408 Request Time-out
Cache-Control: no-cache
Connection: close
Content-Type: text/html

<html><body><h1>408 Request Time-out</h1>
                                         Your browser didn't send a complete req
uest in time.
             </body></html>
                           *CLOS*

I'm pretty sure the problem is with the
set com remote GET$/weatherstation/updateweatherstation.php \n\n
line. I've tried \r\n at the end, nothing at the end, and I keep getting the same results.

Anyone have any ideas?

Benj

Comments

  • BenjBenj Posts: 66
    edited 2013-12-12 06:28
    Well, I've made it a little further. I thought it would be a better idea to try and connect with a webserver I can control and that way I will know much better if the response is what it should be. I set up a basic Apache server on a linux box in my office.

    In /test/test.php, I wrote the following (I used the /test sub-directory to make sure I could connect to something that wasn't at the top level):
    <?php
            echo $_SERVER['QUERY_STRING'];
    ?>
    

    I then sent the following commands to the WiFly, through the serial terminal (in command mode):
    set ip host IP_ADDRESS
    set ip remote 80
    set com set com remote GET$/test/index.php?string=somethinghere$\n\n
    

    And here was the response:
    <4.00> open
    <4.00> *OPEN*HTTP/1.1 200 OK
    Date: Thu, 12 Dec 2013 14:08:33 GMT
    Server: Apache/2.4.6 (Linux/SUSE)
    X-Powered-By: PHP/5.4.20
    Content-Length: 20
    Connection: close
    Content-Type: text/html
    
    string=somethinghere*CLOS*
    

    The only problem was that after typing "open", it responded with "*OPEN*" and then just sat there. I had to hit Enter again, and then I got my response. I'm not sure if that's a problem with my WiFly setup, the commands I'm sending it, or it won't really matter when I finally connect it to a prop for use, because I can always just send an extra <CR> after "open".

    Benj
Sign In or Register to comment.