Hi I'm tring to track my packages with my program..
I should fill a textbox called barkod with a value .. then click the button in the
website : PTT Genel Müdürlü?ü-General Directorate of Turkish Post
Trace Registered Postal Items
_____________________
|___BARCODE NUMBER___| BUTTON
but I couldn't do it, the code still returns the source codes of the main page..
what should I do ??? =((((
orCode:import java.io.*; import java.net.*; import java.security.Security.*; import com.sun.net.ssl.*; import com.sun.*; public class HTTPRequestPoster { public static void main(String args[]) throws Exception { int ch; String page; URL url; url = new URL("http://www.ptt.gov.tr"); HttpURLConnection httpConn; httpConn = (HttpURLConnection)(url.openConnection()); httpConn.setRequestMethod("POST"); httpConn.setRequestProperty("Content-Type", "text/plain"); httpConn.setRequestProperty("barkod", "RJ464842336GB"); BufferedInputStream in = new BufferedInputStream(httpConn.getInputStream()) ; StringBuffer buff = new StringBuffer(); while((ch = in.read()) != -1) buff.append((char)ch); System.out.print(page = buff.toString()); } }
Code:int ch; URL url; url = new URL("http://www.ptt.gov.tr"); // HttpURLConnection httpConn = null; String page; HTMLDocument myDoc = null ; myDoc=(HTMLDocument)url.openConnection(); HTMLInputElement barkod = (HTMLInputElement)myDoc.getElementsByName("barkod"); barkod.setValue("RJ464842336GB"); HTMLInputElement buton = (HTMLInputElement)myDoc.getElementsByName("Sb22"); buton.click();
these don't work !!! =(((((((((((((
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks