langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
17
Task/HTTP/NetRexx/http.netrexx
Normal file
17
Task/HTTP/NetRexx/http.netrexx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref savelog symbols binary
|
||||
|
||||
import java.util.Scanner
|
||||
import java.net.URL
|
||||
|
||||
do
|
||||
rosettaUrl = "http://www.rosettacode.org"
|
||||
sc = Scanner(URL(rosettaUrl).openStream)
|
||||
loop while sc.hasNext
|
||||
say sc.nextLine
|
||||
end
|
||||
catch ex = Exception
|
||||
ex.printStackTrace
|
||||
end
|
||||
|
||||
return
|
||||
5
Task/HTTP/OCaml/http.ocaml
Normal file
5
Task/HTTP/OCaml/http.ocaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
let () =
|
||||
let url = "http://www.rosettacode.org" in
|
||||
let _,_, page_content = make_request ~url ~kind:GET () in
|
||||
print_endline page_content;
|
||||
;;
|
||||
14
Task/HTTP/Objeck/http.objeck
Normal file
14
Task/HTTP/Objeck/http.objeck
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use Net;
|
||||
use Structure;
|
||||
|
||||
bundle Default {
|
||||
class HttpTest {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
client := HttpClient->New("http://rosettacode.org", 80);
|
||||
lines := client->Get();
|
||||
each(i : lines) {
|
||||
lines->GetValue(i)->As(String)->PrintLine();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Task/HTTP/Objective-C/http.m
Normal file
17
Task/HTTP/Objective-C/http.m
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
int main (int argc, const char * argv[]) {
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSError *error;
|
||||
NSURLResponse *response;
|
||||
NSData *data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://rosettacode.org"]]
|
||||
returningResponse:&response
|
||||
error:&error];
|
||||
|
||||
NSLog(@"%@", [[[NSString alloc] initWithData:data
|
||||
encoding:NSUTF8StringEncoding] autorelease]);
|
||||
|
||||
[pool drain];
|
||||
return 0;
|
||||
}
|
||||
10
Task/HTTP/Oz/http-1.oz
Normal file
10
Task/HTTP/Oz/http-1.oz
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
declare
|
||||
fun {GetPage Url}
|
||||
F = {New Open.file init(url:Url)}
|
||||
Contents = {F read(list:$ size:all)}
|
||||
in
|
||||
{F close}
|
||||
Contents
|
||||
end
|
||||
in
|
||||
{System.showInfo {GetPage "http://www.rosettacode.org"}}
|
||||
17
Task/HTTP/Oz/http-2.oz
Normal file
17
Task/HTTP/Oz/http-2.oz
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
declare
|
||||
[HTTPClient] = {Module.link ['x-ozlib://mesaros/net/HTTPClient.ozf']}
|
||||
|
||||
fun {GetPage Url}
|
||||
Client = {New HTTPClient.urlGET
|
||||
init(inPrms(toFile:false toStrm:true)
|
||||
httpReqPrms
|
||||
)}
|
||||
OutParams
|
||||
HttpResponseParams
|
||||
in
|
||||
{Client getService(Url ?OutParams ?HttpResponseParams)}
|
||||
{Client closeAll(true)}
|
||||
OutParams.sOut
|
||||
end
|
||||
in
|
||||
{System.showInfo {GetPage "http://www.rosettacode.org"}}
|
||||
47
Task/HTTP/Pascal/http.pascal
Normal file
47
Task/HTTP/Pascal/http.pascal
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
program http;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
{$DEFINE DEBUG}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Classes, httpsend; // Synapse httpsend class
|
||||
{$R *.res}
|
||||
|
||||
var
|
||||
Response: TStrings;
|
||||
HTTPObj: THTTPSend;
|
||||
|
||||
begin
|
||||
HTTPObj := THTTPSend.Create;
|
||||
try
|
||||
{ Stringlist object to capture HTML returned
|
||||
from URL }
|
||||
Response := TStringList.Create;
|
||||
try
|
||||
if HTTPObj.HTTPMethod('GET','http://wiki.lazarus.freepascal.org/Synapse') then
|
||||
begin
|
||||
{ Load HTTP Document into Stringlist }
|
||||
Response.LoadFromStream(HTTPObj.Document);
|
||||
{ Write the response to the console window }
|
||||
Writeln(Response.Text);
|
||||
end
|
||||
else
|
||||
Writeln('Error retrieving data');
|
||||
|
||||
finally
|
||||
Response.Free;
|
||||
end;
|
||||
|
||||
finally
|
||||
HTTPObj.Free;
|
||||
end;
|
||||
|
||||
// Keep console window open
|
||||
Readln;
|
||||
|
||||
end.
|
||||
5
Task/HTTP/Perl-6/http-1.pl6
Normal file
5
Task/HTTP/Perl-6/http-1.pl6
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
use v6;
|
||||
# Using LWP::Simple from: git://github.com/cosimo/perl6-lwp-simple.git
|
||||
use LWP::Simple;
|
||||
|
||||
print LWP::Simple.get("http://www.rosettacode.org");
|
||||
7
Task/HTTP/Perl-6/http-2.pl6
Normal file
7
Task/HTTP/Perl-6/http-2.pl6
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
use v6;
|
||||
|
||||
my $socket = IO::Socket::INET.new(host => "www.rosettacode.org",
|
||||
port => 80,);
|
||||
$socket.send("GET / HTTP/1.0\r\n\r\n");
|
||||
print $socket.recv();
|
||||
$socket.close;
|
||||
1
Task/HTTP/Pike/http.pike
Normal file
1
Task/HTTP/Pike/http.pike
Normal file
|
|
@ -0,0 +1 @@
|
|||
write("%s",Protocols.HTTP.get_url_data("http://www.rosettacode.org"));
|
||||
2
Task/HTTP/PowerShell/http.psh
Normal file
2
Task/HTTP/PowerShell/http.psh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$wc = New-Object Net.WebClient
|
||||
$wc.DownloadString('http://www.rosettacode.org')
|
||||
1
Task/HTTP/Protium/http-1.protium
Normal file
1
Task/HTTP/Protium/http-1.protium
Normal file
|
|
@ -0,0 +1 @@
|
|||
<@ SAYURLLIT>http://rosettacode.org/wiki/Main_Page</@>
|
||||
1
Task/HTTP/Protium/http-2.protium
Normal file
1
Task/HTTP/Protium/http-2.protium
Normal file
|
|
@ -0,0 +1 @@
|
|||
<# SAY URLSOURCE LITERAL>http://rosettacode.org/wiki/Main_Page</#>
|
||||
17
Task/HTTP/PureBasic/http-1.purebasic
Normal file
17
Task/HTTP/PureBasic/http-1.purebasic
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
InitNetwork()
|
||||
OpenConsole()
|
||||
|
||||
tmpdir$ = GetTemporaryDirectory()
|
||||
filename$ = tmpdir$ + "PB_tempfile" + Str(Random(200000)) + ".html"
|
||||
|
||||
If ReceiveHTTPFile("http://rosettacode.org/wiki/Main_Page", filename$)
|
||||
If ReadFile(1, filename$)
|
||||
Repeat
|
||||
PrintN(ReadString(1))
|
||||
Until Eof(1)
|
||||
Input()
|
||||
; to prevent console from closing if on windows
|
||||
CloseFile(1)
|
||||
EndIf
|
||||
DeleteFile(filename$)
|
||||
EndIf
|
||||
14
Task/HTTP/PureBasic/http-2.purebasic
Normal file
14
Task/HTTP/PureBasic/http-2.purebasic
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
InitNetwork()
|
||||
OpenConsole()
|
||||
id = OpenNetworkConnection("rosettacode.org", 80)
|
||||
SendNetworkString(id, "GET /wiki/Main_Page HTTP/1.1" + Chr(10) + "Host: rosettacode.org" + Chr(10) + Chr(10))
|
||||
Repeat
|
||||
If NetworkClientEvent(id) = 2
|
||||
a$ = Space(1000)
|
||||
ReceiveNetworkData(id, @a$, 1000)
|
||||
out$ + a$
|
||||
EndIf
|
||||
Until FindString(out$, "</html>", 0)
|
||||
PrintN(out$)
|
||||
; next line only to prevent console from closing on Windows
|
||||
Input()
|
||||
2
Task/HTTP/REALbasic/http.realbasic
Normal file
2
Task/HTTP/REALbasic/http.realbasic
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Dim sock As New HTTPSocket
|
||||
Print(sock.Get("http://www.rosettacode.org", 10)) //set the timeout period to 10 seconds.
|
||||
1
Task/HTTP/REBOL/http.rebol
Normal file
1
Task/HTTP/REBOL/http.rebol
Normal file
|
|
@ -0,0 +1 @@
|
|||
print read http://rosettacode.org
|
||||
10
Task/HTTP/RLaB/http.rlab
Normal file
10
Task/HTTP/RLaB/http.rlab
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// get cvs data from Yahoo for Pfeizer (PFE)
|
||||
url="http://ichart.finance.yahoo.com/table.csv?s=PFE&a=00&b=4&c=1982&d=00&e=10&f=2010&g=d&ignore=.csv";
|
||||
|
||||
opt = <<>>;
|
||||
// opt.CURLOPT_PROXY = "your.proxy.here";
|
||||
// opt.CURLOPT_PROXYPORT = YOURPROXYPORT;
|
||||
// opt.CURLOPT_PROXYTYPE = "http";
|
||||
open(url, opt);
|
||||
x = readm(url);
|
||||
close (url);
|
||||
1
Task/HTTP/Run-BASIC/http.run
Normal file
1
Task/HTTP/Run-BASIC/http.run
Normal file
|
|
@ -0,0 +1 @@
|
|||
print httpget$("http://rosettacode.org/wiki/Main_Page")
|
||||
7
Task/HTTP/SNOBOL4/http.sno
Normal file
7
Task/HTTP/SNOBOL4/http.sno
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-include "tcp.sno"
|
||||
tcp.open(.conn,'www.rosettacode.org','http') :s(cont1)
|
||||
terminal = "cannot open" :(end)
|
||||
cont1 conn = "GET http://rosettacode.org/wiki/Main_Page HTTP/1.0" char(10) char(10)
|
||||
while output = conn :s(while)
|
||||
tcp.close(.conn)
|
||||
end
|
||||
7
Task/HTTP/Seed7/http.seed7
Normal file
7
Task/HTTP/Seed7/http.seed7
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "gethttp.s7i";
|
||||
|
||||
const proc: main is func
|
||||
begin
|
||||
writeln(getHttp("www.rosettacode.org"));
|
||||
end func;
|
||||
23
Task/HTTP/TSE-SAL/http.tse
Normal file
23
Task/HTTP/TSE-SAL/http.tse
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
DLL "<urlmon.dll>"
|
||||
INTEGER PROC FNUrlGetSourceApiI(
|
||||
INTEGER lpunknown,
|
||||
STRING urlS : CSTRVAL,
|
||||
STRING filenameS : CSTRVAL,
|
||||
INTEGER dword,
|
||||
INTEGER tlpbindstatuscallback
|
||||
) : "URLDownloadToFileA"
|
||||
END
|
||||
|
||||
// library: url: get: source <description></description> <version control></version control> <version>1.0.0.0.3</version> (filenamemacro=geturgso.s) [kn, ri, su, 13-04-2008 05:12:53]
|
||||
PROC PROCUrlGetSource( STRING urlS, STRING filenameS )
|
||||
FNUrlGetSourceApiI( 0, urlS, filenameS, 0, 0 )
|
||||
END
|
||||
|
||||
PROC Main()
|
||||
STRING s1[255] = "http://www.google.com/index.html"
|
||||
STRING s2[255] = "c:\temp\ddd.txt"
|
||||
IF ( NOT ( Ask( "url: get: source: urlS = ", s1, _EDIT_HISTORY_ ) ) AND ( Length( s1 ) > 0 ) ) RETURN() ENDIF
|
||||
IF ( NOT ( AskFilename( "url: get: source: filenameS = ", s2, _DEFAULT_, _EDIT_HISTORY_ ) ) AND ( Length( s2 ) > 0 ) ) RETURN() ENDIF
|
||||
PROCUrlGetSource( s1, s2 )
|
||||
EditFile( s2 )
|
||||
END
|
||||
3
Task/HTTP/TUSCRIPT/http.tuscript
Normal file
3
Task/HTTP/TUSCRIPT/http.tuscript
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$$ MODE TUSCRIPT
|
||||
SET DATEN = REQUEST ("http://www.rosettacode.org")
|
||||
*{daten}
|
||||
1
Task/HTTP/UNIX-Shell/http-1.sh
Normal file
1
Task/HTTP/UNIX-Shell/http-1.sh
Normal file
|
|
@ -0,0 +1 @@
|
|||
curl -s -L http://rosettacode.org/
|
||||
1
Task/HTTP/UNIX-Shell/http-2.sh
Normal file
1
Task/HTTP/UNIX-Shell/http-2.sh
Normal file
|
|
@ -0,0 +1 @@
|
|||
lynx -source http://rosettacode.org/
|
||||
1
Task/HTTP/UNIX-Shell/http-3.sh
Normal file
1
Task/HTTP/UNIX-Shell/http-3.sh
Normal file
|
|
@ -0,0 +1 @@
|
|||
wget -O - -q http://rosettacode.org/
|
||||
1
Task/HTTP/UNIX-Shell/http-4.sh
Normal file
1
Task/HTTP/UNIX-Shell/http-4.sh
Normal file
|
|
@ -0,0 +1 @@
|
|||
lftp -c "cat http://rosettacode.org/"
|
||||
1
Task/HTTP/UNIX-Shell/http-5.sh
Normal file
1
Task/HTTP/UNIX-Shell/http-5.sh
Normal file
|
|
@ -0,0 +1 @@
|
|||
ftp -o - http://rosettacode.org 2>/dev/null
|
||||
17
Task/HTTP/VBScript/http.vbscript
Normal file
17
Task/HTTP/VBScript/http.vbscript
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
Option Explicit
|
||||
|
||||
Const sURL="http://rosettacode.org/"
|
||||
|
||||
Dim oHTTP
|
||||
Set oHTTP = CreateObject("Microsoft.XmlHTTP")
|
||||
|
||||
On Error Resume Next
|
||||
oHTTP.Open "GET", sURL, False
|
||||
oHTTP.Send ""
|
||||
If Err.Number = 0 Then
|
||||
WScript.Echo oHTTP.responseText
|
||||
Else
|
||||
Wscript.Echo "error " & Err.Number & ": " & Err.Description
|
||||
End If
|
||||
|
||||
Set oHTTP = Nothing
|
||||
5
Task/HTTP/Visual-Basic-.NET/http.visual
Normal file
5
Task/HTTP/Visual-Basic-.NET/http.visual
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Imports System.Net
|
||||
|
||||
Dim client As WebClient = New WebClient()
|
||||
Dim content As String = client.DownloadString("http://www.google.com")
|
||||
Console.WriteLine(content)
|
||||
Loading…
Add table
Add a link
Reference in a new issue