Hello
I am automating search of information on the internet
it is to access the following website:
>>>> http://www.gatwickaviationsociety.org.u ... lookup.asp
then enter a code in the "Code S Mode" and click "Find"
(40643C, 391E0C, 3444CC, ....)
to retrieve the information about a given aircraft
the goal is to automatically make several searches.
with APL (under windows 7) I recover well the first page in the HTML variable, with the following command:
'www.gatwickaviationsociety.org.uk' QUERY 'GET /modeslookup.asp'
but how to simulate the input of the variable "Mode S Code" ???
I conducted an analysis of data that is sent when running in Firefox:
there is indeed a request "GET" to display the initial screen
then a request "POST" for the interrogation itself, with the following parameter:
POSTDATA MSC=40643C&Registration=&DICAOType=&DType=&DSerial=&DOperator=&DICAOOperator=&DSubOperator=&Submit2=Find
which has the effect of assigning a value to the variables of the HTML page: MSC Submit2
the "GET" requests are well described in the documentation (Interface Guide) but I found nothing about the "POST"
does this search is possible ?
how to proceed ?
I have made a few attempts, but I get systématiquenet the following message:
"HTTP Error 411. The request must be chunked gold-have a happy length"
Writing a Web Client : how to code a request "POST" ? ....
-
- Posts: 7
- Joined: Wed Feb 15, 2012 10:55 am
- Location: Yvelines - France
- Brian|Dyalog
- Posts: 120
- Joined: Thu Nov 26, 2009 4:02 pm
- Location: West Henrietta, NY
Re: Writing a Web Client : how to code a request "POST" ? ..
Hi Jean-Pierre!
You can use HTTPCmd from the Samples namespace in Conga version 2.6 to issue any HTTP command (GET, POST, DELETE, etc). Conga version 2.6 was released coincident with Dyalog APL 14.1.
The third element of the result is the actual data from the server, in this case, the HTML that makes up the response web page. You'll need to parse/examine this for the information you're looking for. I took a quick look, and the HTML that's returned is not particularly easy to transform into XHTML so that you could manipulate it with ⎕XML.
I noticed that Gatwick Aviation Society has a web service which offers several functions at http://www.gatwickaviationsociety.org.uk/ADControls/SiteLookups.asmx, however, I don't know if any of these provide the information you're looking for. The advantage of calling a web service is that the data returned is intended for processing under program control, rather than being HTML intended to be rendered by a browser.
I hope this helps!
/Brian
You can use HTTPCmd from the Samples namespace in Conga version 2.6 to issue any HTTP command (GET, POST, DELETE, etc). Conga version 2.6 was released coincident with Dyalog APL 14.1.
Code: Select all
url←'http://www.gatwickaviationsociety.org.uk/modeslookup.asp'
form←'MSC=40643C&Submit2=Find' ⍝ you need only supply the form inputs that have values
z←('post' Samples.HTTPCmd) url form
⍴z
3
1⊃z ⍝ 0 return code indicates success
0
2⊃z ⍝ second item in the result is a matrix of the response HTTP headers
http/1.1 200 ok
cache-control private
content-length 27917
content-type text/html
expires Tue, 17 Nov 2015 15:08:23 GMT
server Microsoft-IIS/7.5
set-cookie ASPSESSIONIDQSRRABDT=AIKGCDFBMJBPBFNPLOOKJEFM; path=/
x-powered-by ASP.NET
x-powered-by-plesk PleskWin
date Tue, 17 Nov 2015 15:08:22 GMT
The third element of the result is the actual data from the server, in this case, the HTML that makes up the response web page. You'll need to parse/examine this for the information you're looking for. I took a quick look, and the HTML that's returned is not particularly easy to transform into XHTML so that you could manipulate it with ⎕XML.
I noticed that Gatwick Aviation Society has a web service which offers several functions at http://www.gatwickaviationsociety.org.uk/ADControls/SiteLookups.asmx, however, I don't know if any of these provide the information you're looking for. The advantage of calling a web service is that the data returned is intended for processing under program control, rather than being HTML intended to be rendered by a browser.
I hope this helps!
/Brian
-
- Posts: 7
- Joined: Wed Feb 15, 2012 10:55 am
- Location: Yvelines - France
Re: Writing a Web Client : how to code a request "POST" ? ..
Hi Brian
thank you very much for that
I had thought of looking good in Conga, but I only have version 2.2 (Dyalog 13.1).
my search on the keyword "POST" is left unanswered
>>> Do I have the opportunity to access the version 2.6 Conga?
regarding the analysis of the result, I simply need to extract some strings for including it into my treatments.
all my programs are in APL, it will therefore have any problem.
I also thank you for the link to the "web service", but this is something totally new to me
I would have to spend a little time
immediately I will leave to use the only language I know: the APL
as I already mentioned, the work that I realize, are only for fun, a volunteer for an association that defends against aircraft disturbances
Jean-Pierre
thank you very much for that
I had thought of looking good in Conga, but I only have version 2.2 (Dyalog 13.1).
my search on the keyword "POST" is left unanswered
>>> Do I have the opportunity to access the version 2.6 Conga?
regarding the analysis of the result, I simply need to extract some strings for including it into my treatments.
all my programs are in APL, it will therefore have any problem.
I also thank you for the link to the "web service", but this is something totally new to me
I would have to spend a little time
immediately I will leave to use the only language I know: the APL
as I already mentioned, the work that I realize, are only for fun, a volunteer for an association that defends against aircraft disturbances
Jean-Pierre