with(HTTP);
[Code, Get, Post, URLDecode, URLEncode, URLParse]
But undocumented in Maple 12...
From ?HTTP,Get in Maple 11.02:
HTTP[Get]
Calling Sequence
Get (uri, headers)
Parameters
uri - host, port, and url path of the form http://host:port/path/to/file?query
headers - (optional) list of header values; duplicate values are combined into a single comma-separated list
Returns
Get returns a tupe (code, headers, content) with code set to the return code sent by the server, headers as a table, and content containing the body of the server response.
The HTTP package looks to have a lot of potential. However, while I can load the package in both Maple 11.02 and Maple 12, I do not see any documentation in either version of Maple. Is there somewhere I can see the full documentation for this package.
The meat of the package seems to be a SendRequest procedure. I have not been able to find any information about SendRequest. Can anyone give any pointers on this procedure and how it is designed to be used?
Thanks in advance,
Doug
---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.ed
Full documentation? No, these help pages are minimal, and there is no page for 'Code'.
Send request. I guess that you mean this:
?HTTP.Post
HTTP[Post]
Calling Sequence
Post (uri, content, headers)
Parameters
uri - host, port, and url path of the form http://host:port/path/to/file
content - content of the HTTP request
headers - (optional) list of header values; duplicate values are combined into a single comma-separated list
Returns
Post returns a tuple (code, headers, content) with code set to the return code sent by the server, headers as a table, and content containing the body of the server response.
With verboseproc=2, eval(HTTP) shows that SendRequest is local to the module. It is not exported. So eval(HTTP:-SendRequest) and showstat( HTTP:-SendRequest, 10 ) give nothing. Is there a way to see the whole HTTP module including the SendRequest command?
works in 11.02 and 12 both Classic and Standard but the help page only exists in 11.02 standard. And you have to have the quotes.
The command
Get("http://www.math.tamu.edu/~yasskin");
returns
301, "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.math.tamu.ed\
u/~yasskin/">here</a>.</p>
<hr>
<address>Apache/2.2.4 (Linux/SUSE) Server at www.math.tamu\
.edu Port 80</address>
</body></html>"
1) There are no headers, even though the help says there will be. Why not?
Following the code in my blog, I get all the headers,
with(StringTools):with(Sockets):s:=Open("www.math.tamu.edu",80):
Write(s,"GET /~yasskin/ HTTP/1.0\n\n"):
a := "":
b := Read(s):
while b <> false do
a := cat(a,b):
b := Read(s):
end do:
Close(s):
a;
Sure
See my blog posts, Accessing Magma from Maple and Search Pi.
Alec
Sockets
Your Sockets method seems much more basic. I assume it works for POST too.
Thanks,
Phil
POST
It should. I never tried it myself with POST, though (for forms) - too much typing (headers), and GET usually works OK even if forms use method=post.
I should say that it is not my method - I found it somewhere in the Maple Application center (don't remember exactly where - it was a long time ago.)
Alec
package HTTP
is available already in Maple 11.02:
But undocumented in Maple 12...
From ?HTTP,Get in Maple 11.02:
HTTP help?
The HTTP package looks to have a lot of potential. However, while I can load the package in both Maple 11.02 and Maple 12, I do not see any documentation in either version of Maple. Is there somewhere I can see the full documentation for this package.
The meat of the package seems to be a SendRequest procedure. I have not been able to find any information about SendRequest. Can anyone give any pointers on this procedure and how it is designed to be used?
Thanks in advance,
Doug
In Classic GUI Maple 11.02
I get the help pages, but not in Standard...
Full documentation? No, these help pages are minimal, and there is no page for 'Code'.
Send request. I guess that you mean this:
?HTTP.Post
SendRequest
SendRequest appears to be the real engine behind the HTTP package.
Where can I find more about SendRequest?
Doug
module opacity
acer
"Man is the measure of all things: of those which are, that they are, and of those which are not, that they are not" -- Tag the mag'
HTTP:-SendRequest
With verboseproc=2, eval(HTTP) shows that SendRequest is local to the module. It is not exported. So eval(HTTP:-SendRequest) and showstat( HTTP:-SendRequest, 10 ) give nothing. Is there a way to see the whole HTTP module including the SendRequest command?
Phil
yes
Entering,
will subsequently allow those showstat() or eval() calls to access that non-exported local member SendRequest of the HTTP module.
acer
Thanks all, Works in 11.02 and 12, Classic and Standard
Thanks all for the replies.
I tried things:
The command
Get("http://www.math.tamu.edu/~yasskin/");
works in 11.02 and 12 both Classic and Standard but the help page only exists in 11.02 standard. And you have to have the quotes.
The command
Get("http://www.math.tamu.edu/~yasskin");
returns
301, "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.math.tamu.ed\
u/~yasskin/">here</a>.</p>
<hr>
<address>Apache/2.2.4 (Linux/SUSE) Server at www.math.tamu\
.edu Port 80</address>
</body></html>"
1) There are no headers, even though the help says there will be. Why not?
2) Also it appears you have to have the final /.
Manually
Following the code in my blog, I get all the headers,
with(StringTools):with(Sockets):s:=Open("www.math.tamu.edu",80): Write(s,"GET /~yasskin/ HTTP/1.0\n\n"): a := "": b := Read(s): while b <> false do a := cat(a,b): b := Read(s): end do: Close(s): a;Alec