⇤ ← Revision 1 as of 2006-12-31 21:12:57
Size: 1123
Comment:
|
Size: 1144
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 29: | Line 29: |
Author: KaiJaeger |
The following code is asking Google for a search on two words: "dyalog" and "apl":
System∆Net∆WebRequest;⎕ML;⎕IO;htmlPage;MyWebRequest;TheResponse;MyStream;URL ⍝ Version 1.0 from 2006-12-24 ⋄ Kai Jaeger ⋄ APL Team Ltd ⎕ML ⎕IO←1 ⎕USING←'System,System.dll' '' URL←'http://www.google.co.uk/search?q=dyalog+apl&ie=utf-8&oe=utf-8&rls=org.mozilla:en-GB:official&client=firefox-a' ⍝ Create a request for the URL MyWebRequest←System.Net.WebRequest.Create⊂URL ⍝ If required by the server,set the credentials. MyWebRequest.Credentials←System.Net.CredentialCache.DefaultCredentials ⍝ Get the response TheResponse←MyWebRequest.GetResponse ⍝ Display the status ⎕←TheResponse.StatusDescription ⍝ Get the stream containing content returned by the server MyStream←TheResponse.GetResponseStream ⍝ Open the stream using a StreamReader htmlPage←⎕TC[2]~⍨(System.IO.StreamReader.New MyStream).ReadToEnd ⍝ Reformat because we can't see much otherwise htmlPage({⍺⊂⍨⍵=⍺})←'<' ⍝ Display what we get ⎕ED'htmlPage' ⍝ End
Author: KaiJaeger