Re: http


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]

Posted by Robert G Laurin on September 24, 2013 at 13:16:19:

In Reply to: Re: http posted by Tom Fulton on September 24, 2013 at 10:04:31:

You may want to do some reading...

http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol

also look at the references at the bottom (items 11 & 12)

All commands returning a RESULT$ should have a '+' as first character in the response to be valid.

Step by step...
- Find & Open a Gateway of type @03@
- Connect to host by using RESULT$=CONTROL(Gxx$,CMD$) Where CMD is 'OPEN ' + HostName-or-IPAddress + ' 80' where 80 is port for http or you can use any other port that meets your need. Some well known ports are predefined (HTTP|MAIL|FTP).
- Issue a Auto CR/LF by using RESULT$=CONTROL(Gxx$,CMD$) where CMD$ = 'CRLF 1'
- To send a http request, let CMD$ be:

'GET request HTTP/1.0' + '@0d0a@'

where request is the complete web page request. It is composed of:
- the desired page name (ex: /whatever/mypage.html or /xap/cgilogin)
- a single '?' for the field list
- a serie of variables=values separated by '&'

Make sure you request is URL Encoded by replacing any occurrences of the following characters: "\'+;:?&=@%# " with a '%' followed with it's hex equivalent

Example:

http://www.computer.com/parts/cpu?vendor=Genuine+Intel&Name=Inter(R) Pentium(R) 4 CPU

would become:

> CONTROL(Gxx,' connect www.computer.com 80')
< +
> CONTROL(Gxx$,'CRLF 1')
< +
> CONTROL(Gxx$,'GET /parts/cpu?vendor=Genuine%2aIntel&Name=Intel(R)%20Pentium(R)%204%20CPU HTTP/1.0 @0D0A@')
< ...

I imagine POST works like GET. In a browser, POST is more discreet that GET (does not show on the URL line).

I wrote code for this a couple of years back and unfortunately I cannot locate my test programs.


I hope this helps a bit



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

What is the name of the main Signature System's Product?  

Comments:

Optional Link URL:
Link Title:
Optional Image URL:

You may attach up to 5 files to your followup (see below):





Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]