Subj : Re: Attempting to add reCaptcha
To : Noisome
From : echicken
Date : Mon Apr 15 2013 12:02 pm
Re: Re: Attempting to add reCaptcha
By: Noisome to Mro on Sat Apr 13 2013 12:49:58
No> But anyway, http.js, any example on the best usage? :)
Here's a basic example showing a couple of uses of HTTPRequest.Get and
HTTPRequest.Post:
// Load the HTTP request library
load("http.js");
var response;
var http;
// Create HTTPRequest object 'http'
http = new HTTPRequest();
// Make a GET request, print the response
response = http.Get("
http://bbs.electronicchicken.com/test.xjs");
print(response);
// Make a GET request with arguments in the query string, print the response
response = http.Get(
"
http://bbs.electronicchicken.com/test.xjs?argument1=lol&argument2=dongs"
);
print(response);
// Make a POST request, print the response
response = http.Post(
"
http://bbs.electronicchicken.com/test.xjs",
"&argument1=lol&argument2=dongs"
);
print(response);
// End of example
If you want to get a bit fancy, you can wrap your .Get and .Post requests in
try ... catch blocks so that any errors that are encountered don't get shown to
your users:
try {
response = http.Get("
http://this.will.not.work");
print(response);
} catch(err) {
log("There was an error: " + err);
}
Otherwise if the HTTP request fails for any reason, an error will be barfed out
onto your page.
echicken
electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
---
� Synchronet � electronic chicken bbs - bbs.electronicchicken.com