Change comment:
There is no comment for this version
Summary
-
Objects (1 modified, 0 added, 0 removed)
Details
- XWiki.FAQClass[0]
-
- Answer
-
... ... @@ -4,8 +4,9 @@ 4 4 5 5 {code} 6 6 <% 7 + URL twitterURL; 7 7 try { 8 - URLtimelineURL = new URL("http://twitter.com/statuses/public_timeline.xml");9 + timelineURL = new URL("http://twitter.com/statuses/public_timeline.xml"); 9 9 10 10 def connection = timelineURL.openConnection(); 11 11 def text = connection.content.text ... ... @@ -28,16 +28,15 @@ 28 28 29 29 {code} 30 30 <% 31 - try { 32 - updateURL = new URL("http://twitter.com/statuses/update.xml"); 32 + updateURL = new URL("http://twitter.com/statuses/update.xml"); 33 33 34 - def connection = updateURL.openConnection(); 34 + def connection = updateURL.openConnection(); 35 35 36 - connection.setRequestProperty("Authorization", "Basic " + 36 + connection.setRequestProperty("Authorization", "Basic " + 37 37 (new sun.misc.BASE64Encoder().encode("username:password".getBytes()))); 38 38 39 - connection.setDoOutput(true); 40 - connection.setRequestMethod("POST"); 39 + connection.setDoOutput(true); 40 + connection.setRequestMethod("POST"); 41 41 42 42 def osr = new OutputStreamWriter(connection.getOutputStream()); 43 43 osr.write("status="+"Here the status you want to update"); ... ... @@ -44,12 +44,6 @@ 44 44 osr.close(); 45 45 46 46 def responseText = connection.content.text 47 - 48 - //[...] 49 - 50 - } catch (Exception e) { 51 - print( e.message + "\n" ) 52 - } 53 53 %> 54 54 {code} 55 55