{"id":652,"date":"2005-01-08T23:45:49","date_gmt":"2005-01-09T03:45:49","guid":{"rendered":"http:\/\/wordpress.cephas.net\/?p=652"},"modified":"2005-01-08T23:45:49","modified_gmt":"2005-01-09T03:45:49","slug":"dropcash-and-java","status":"publish","type":"post","link":"https:\/\/cephas.net\/blog\/2005\/01\/08\/dropcash-and-java\/","title":{"rendered":"dropcash and Java"},"content":{"rendered":"<p>If you&#8217;ve ever needed to raise a couple bucks for a project, a birthday or a fundraiser, you should check out <a href=\"http:\/\/www.dropcash.com\/\">dropcash<\/a> (by <a href=\"http:\/\/torrez.org\/\">Andre Torres<\/a>). dropcash lets you set up a personal fundraising campaign using paypal and TypeKey. The campaign can be dropped into your site using a simple JavaScript include just like Flickr or Google Adsense, but you can programatically access the status of your campaign using the XML feed.  There are a couple different implementations of the <a href=\"http:\/\/www.dropcash.com\/doc\/api.php\">API<\/a> (COM, MovableType, TextPattern and ColdFusion, <a href=\"http:\/\/dropcash.blogspot.com\/2004\/10\/dropcash-api.html\">more&#8230;<\/a>), but no Java so I wrapped up a Java version and a JSP version.  JSP is simpler of the two:<code><br \/>\n&lt;%@ taglib prefix=\"c\" uri=\"http:\/\/java.sun.com\/jsp\/jstl\/core\" %&gt;<br \/>\n&lt;%@ taglib prefix=\"x\" uri=\"http:\/\/java.sun.com\/jsp\/jstl\/xml\" %&gt;<br \/>\n&lt;c:import var=\"dropcash\" url=\"http:\/\/www.dropcash.com\/campaign\/ajohnson1200\/test\/xml\"\/&gt;<br \/>\n&lt;x:parse var=\"dropcashxml\" doc=\"${dropcash}\"\/&gt;<br \/>\ncampaignid: &lt;x:out select=\"$dropcashxml\/\/@id\" \/&gt;<br \/>\ntypekey_user: &lt;x:out select=\"$dropcashxml\/\/typekey_user\"\/&gt;<br \/>\nreceiver: &lt;x:out select=\"$dropcashxml\/\/receiver\"\/&gt;<br \/>\ntitle: &lt;x:out select=\"$dropcashxml\/\/title\"\/&gt;<br \/>\ngoal: &lt;x:out select=\"$dropcashxml\/\/goal\"\/&gt;<br \/>\ntotal_collected: &lt;x:out select=\"$dropcashxml\/\/total_collected\"\/&gt;<br \/>\ndescription: &lt;x:out select=\"$dropcashxml\/\/description\"\/&gt;<br \/>\npercentage: &lt;x:out select=\"$dropcashxml\/\/percentage\"\/&gt;<br \/>\n<\/code><br \/>\nJava less straightforward:<code><br \/>\nURL url = new URL(\"http:\/\/www.dropcash.com\/campaign\/ajohnson1200\/test\/xml\");<br \/>\nHttpURLConnection uc = (HttpURLConnection)url.openConnection();<br \/>\nuc.connect();<br \/>\nInputStream is = uc.getInputStream();<br \/>\nDocumentBuilderFactory docfactory = DocumentBuilderFactory.newInstance();<br \/>\nInputStream inputXML = url.openStream();<br \/>\nDocumentBuilder docbuilder = docfactory.newDocumentBuilder();<br \/>\nDocument document = docbuilder.parse(inputXML);<br \/>\nElement campaign = document.getDocumentElement();<br \/>\nSystem.out.println(\"campaignid = \" + campaign.getAttribute(\"id\"));<br \/>\nNodeList nodes = campaign.getChildNodes();<br \/>\nfor (int i=0; i<br \/>\nDownload the full <a href=\"\/projects\/dropcash\/dropcash.jsp.txt\">JSP<\/a> and <a href=\"\/projects\/dropcash\/DropCashRestClient.java\">Java<\/a> source code.<\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;ve ever needed to raise a couple bucks for a project, a birthday or a fundraiser, you should check out dropcash (by Andre Torres). dropcash lets you set up a personal fundraising campaign using paypal and TypeKey. The campaign can be dropped into your site using a simple JavaScript include just like Flickr or &hellip; <a href=\"https:\/\/cephas.net\/blog\/2005\/01\/08\/dropcash-and-java\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">dropcash and Java<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/652"}],"collection":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/comments?post=652"}],"version-history":[{"count":0,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/652\/revisions"}],"wp:attachment":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/media?parent=652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/categories?post=652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/tags?post=652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}