Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:io';
|
||||
void main(){
|
||||
String url = 'http://rosettacode.org';
|
||||
HttpClient client = new HttpClient();
|
||||
var url = 'http://rosettacode.org';
|
||||
var client = new HttpClient();
|
||||
client.getUrl(Uri.parse(url))
|
||||
.then((HttpClientRequest request) => request.close())
|
||||
.then((HttpClientResponse response) => response.pipe(stdout));
|
||||
|
|
|
|||
7
Task/HTTP/JavaScript/http-1.js
Normal file
7
Task/HTTP/JavaScript/http-1.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
var req = new XMLHTTPRequest();
|
||||
req.onload = function() {
|
||||
console.log(this.responseText);
|
||||
};
|
||||
|
||||
req.open('get', 'http://rosettacode.org', true);
|
||||
req.send()
|
||||
3
Task/HTTP/JavaScript/http-2.js
Normal file
3
Task/HTTP/JavaScript/http-2.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$.get('http://rosettacode.org', function(data) {
|
||||
console.log(data);
|
||||
};
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
((function(url,callback,method,post,headers){//headers is an object like this {Connection:"keep-alive"}
|
||||
function createXMLHttpRequest() {
|
||||
if (typeof XMLHttpRequest != "undefined") {
|
||||
return new XMLHttpRequest();
|
||||
} else if (typeof window.ActiveXObject != "undefined") {
|
||||
try {
|
||||
return new ActiveXObject("Msxml2.XMLHTTP.4.0");
|
||||
} catch (e) {
|
||||
try {
|
||||
return new ActiveXObject("MSXML2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
return new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function looProp(object,callback){
|
||||
var a;
|
||||
for(a in object){
|
||||
if(object.hasOwnProperty(a))callback.call(object,a,object[a]);
|
||||
}
|
||||
}
|
||||
method=method||"GET";
|
||||
var xhr=createXMLHttpRequest();
|
||||
if(xhr){
|
||||
xhr.open(method,url,true);
|
||||
looProp(headers,function(a,b){xhr.setRequestHeader(a,b)})
|
||||
xhr.onreadystatechange=function(){if(xhr.readyState==xhr.DONE){callback(xhr)}};
|
||||
xhr.send(post);
|
||||
return xhr;}else{return null;}
|
||||
})('http://rosettacode.org',function(xhr){console.log(xhr.responseText)}))
|
||||
|
|
@ -1,20 +1,4 @@
|
|||
local http = require("socket.http")
|
||||
function url_encode(str)
|
||||
if (str) then
|
||||
str = string.gsub (str, "\n", "\r\n")
|
||||
str = string.gsub (str, "([^%w ])",
|
||||
function (c) return string.format ("%%%02X", string.byte(c)) end)
|
||||
str = string.gsub (str, " ", "+")
|
||||
end
|
||||
return str
|
||||
end
|
||||
function url_decode(str)
|
||||
str = string.gsub (str, "+", " ")
|
||||
str = string.gsub (str, "%%(%x%x)",
|
||||
function(h) return string.char(tonumber(h,16)) end)
|
||||
str = string.gsub (str, "\r\n", "\n")
|
||||
return str
|
||||
end
|
||||
|
||||
local page = http.request( 'http://www.google.com/m/search?q=' .. url_encode("lua") )
|
||||
print( page )
|
||||
local url = require("socket.url")
|
||||
local page = http.request('http://www.google.com/m/search?q=' .. url.escape("lua"))
|
||||
print(page)
|
||||
|
|
|
|||
1
Task/HTTP/Maple/http-1.maple
Normal file
1
Task/HTTP/Maple/http-1.maple
Normal file
|
|
@ -0,0 +1 @@
|
|||
content := URL:-Get( "http://www.google.com/" );
|
||||
1
Task/HTTP/Maple/http-2.maple
Normal file
1
Task/HTTP/Maple/http-2.maple
Normal file
|
|
@ -0,0 +1 @@
|
|||
content := HTTP:-Get( "http://www.google.com/" );
|
||||
|
|
@ -1 +0,0 @@
|
|||
HTTP:-Get( "http://www.google.com" );
|
||||
Loading…
Add table
Add a link
Reference in a new issue