Selecting ASCII in Java -
sending url post , answer throughout bufferredreader respond coming in ascii. how incoming string can break pieces , use string need?
params.put("ssl_result_format", "ascii"); bufferedreader in = new bufferedreader(new inputstreamreader(conn.getinputstream(), "utf-8")); string line; receipt pp = new receipt(); pp.setvisible(true); while ((line = in.readline()) != null) { receipt.recetext.append(line + "\n"); system.out.println(line);
this how display:
ssl_card_number=50**********3003 ssl_exp_date=1215 ssl_amount=12.00 ssl_invoice_number= ssl_departure_date= ssl_completion_date= ssl_issue_points= ssl_promo_code= ssl_enrollment= ssl_result=0 ssl_result_message=approval ssl_txn_id=051214a15-6e33e984-7c6b-466d-b38c-83f24bdac631 etc......
edit: finished this:
properties prop = new properties(); bufferedreader in = new bufferedreader(new inputstreamreader(conn.getinputstream(), "utf-8")); prop.load(in); string amount = prop.getproperty("ssl_amount"); string card = prop.getproperty("ssl_card_number"); string approval = prop.getproperty("ssl_approval_code"); string results = prop.getproperty("ssl_result_message"); string time = prop.getproperty("ssl_txn_time"); string errorcode = prop.getproperty("errorcode"); string errormessage = prop.getproperty("errormessage"); string errorname = prop.getproperty("errorname"); if(errorcode == null){ receipt pp = new receipt(); pp.setvisible(true); receipt.amountlabel.settext(amount); receipt.cardlabel.settext(card); receipt.approvallabel.settext(approval); receipt.respondlabel.settext(results); receipt.datelabel.settext(time); }else{ joptionpane.showmessagedialog(null,errorname,errormessage,joptionpane.error_message); }
+1 crunchify.com
in while loop, check see if line starts care about. example,
while ((line = in.readline() != null) { if (line.startswith("ssl_amount") { receipt.recetext.append(line + "\n"); system.out.println(line); } }
Comments
Post a Comment