tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Jsoup > Post Connection

Post Connection 

Jsoup is an open source java library for parsing and manipulating HTML with ease. Get the latest binaries from http://jsoup.org/. This requires the library jsoup-1.6.1.jar to be in classpath. The following example shows getting the PNR status by making HTTP Post request.

File Name  :  
com/bethecoder/tutorials/jsoup/tests/PostConnectTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.jsoup.tests;

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class PostConnectTest {

  /**
   @param args
   @throws IOException 
   */
  public static void main(String[] argsthrows IOException {
    //Getting PNR status
    Document doc = Jsoup.connect(
        "http://www.indianrail.gov.in/cgi_bin/inet_pnrstat_cgi.cgi")
        
        .data("lccp_pnrno1""423")
        .data("lccp_pnrno2""4101443")
        .data("textPnrNumber""4234101443")
        .post();

    //System.out.println(doc.html());
    System.out.println(doc.select("table[id=center_table]"));
  }

}
   

It gives the following output,
File Name  :  OUTPUT


                    Print

   



Books Recommendation

 
 
bl  br