Question: In my current application(A), I redirect user to a different website(B) where user logs in with his/her account and finishes some activity and now that website(B) has a button to return my application(A), the redirection happens by posting a `SAMLResponse`.

When user clicks that button, user return to my application(A) with specific unique user id assigned by that website(B) in "`Form Data`" of header information.Basically website B is also posting `SAMLResponse` as a form parameter in a request.

How do I read this request information in php and java?

Answer: 
The following links are helpful although they are not exactly what you want.
Do have a look.....

Regards

[1] <http://www.coderanch.com/t/545270/java/java/Decode-SAML-Request>

[2] [Consume SAMLResponse Token](https://stackoverflow.com/questions/6681083/consume-samlresponse-token)

[3] <http://goo.gl/iW1N9V>
The "form data" part is unclear, but you can print the source code of your desired url/form to the console like this:

```
import java.io.*;
import java.net.*;

public class Client {

 public String getHTML(String urlToRead) {
  URL url;
  HttpURLConnection conn;
  BufferedReader rd;
  String line;
  String result = "";
  try {
     url = new URL(urlToRead);
     conn = (HttpURLConnection) url.openConnection();
     conn.setRequestMethod("GET");
     rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
     while ((line = rd.readLine()) != null) {
      //basically makes a huge string
         result += line;
     }
     rd.close();
  } catch (Exception e) {
     e.printStackTrace();
  }
  return result;
 }

public static void main(String args[])
{
  Client c = new Client();
 System.out.println(c.getHTML("YOUR URL HERE"));
 //prints source code to console

}

//from here, you need to know which item you want to do is at which index of the string
}

```