aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/Utils.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-03-29 16:29:02 +0700
committerGravatar Ugnich Anton2013-03-29 16:29:02 +0700
commitcdd48f30c7fca97327de48ff6b1cd9edf1629a5d (patch)
tree1544f451f0b7b2ace04a6a560f3cf89936a0892f /src/java/com/juick/http/www/Utils.java
parent19cf26ce2f8ee05fc8a9298e2c19b8fff589b8e6 (diff)
Facebook signup
Diffstat (limited to 'src/java/com/juick/http/www/Utils.java')
-rw-r--r--src/java/com/juick/http/www/Utils.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/java/com/juick/http/www/Utils.java b/src/java/com/juick/http/www/Utils.java
index 38550691..4c41555e 100644
--- a/src/java/com/juick/http/www/Utils.java
+++ b/src/java/com/juick/http/www/Utils.java
@@ -17,6 +17,10 @@
*/
package com.juick.http.www;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -118,4 +122,20 @@ public class Utils {
ret = ret.replaceAll("@", "\\\\@");
return ret;
}
+
+ public static String fetchURL(String url) {
+ try {
+ URLConnection c = new URL(url).openConnection();
+ BufferedReader in = new BufferedReader(new InputStreamReader(c.getInputStream()));
+ String inputLine;
+ StringBuilder b = new StringBuilder();
+ while ((inputLine = in.readLine()) != null) {
+ b.append(inputLine).append("\n");
+ }
+ in.close();
+ return b.toString();
+ } catch (Exception e) {
+ return null;
+ }
+ }
}