Php .NET Passport

January 12, 2007 by PHP   This post is closed for comments.   This post is marked as obsolete.

Ever tried to create a client area in PHP using .NET passport as your authentication method?

Personally I don't believe in .NET passports, a script like this can easily be used to capture passwords.

Here's a little example of how to get it running, it uses the CURL library to send requests.

function setRequest($url,$headers)
	if (function_exists('curl_init'))
		$curl = curl_init();
		curl_setopt($curl, CURLOPT_URL, $url);
		curl_setopt($curl, CURLOPT_FAILONERROR, TRUE);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
		curl_setopt($curl, CURLOPT_VERBOSE, FALSE);
		curl_setopt($curl, CURLOPT_HEADER,TRUE);
		curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
		$data = curl_exec($curl);
		return $data;
	else die('Error: <a href="">CURL Library</a> Not found!');

function Authentication($username, $password)
	$arr[] = "GET /rdr/pprdr.asp HTTP/1.0\\r\\n\\r\\n";
	$data = setRequest ("",$arr);
	if ($data)
		$split = explode("/",$matches[1]);
		$headers = array("GET /$split[1] HTTP/1.1\\r\\n", 
							"Authorization: Passport1.4 OrgVerb=GET,OrgURL=,sign-in=$username,pwd=$password");

		$data = setRequest("https://" . $split[0] . ":443/". $split[1], $headers);
		return ($data) ? TRUE : FALSE;
		return FALSE;

Now to use it is quite simple (example below), I am planning to create a few example login systems once I get time.

if (Authentication("","password"))
		print "Authentication Success";
		print "Authentication Failed";

May 13, 2011 by boujemaa


after authentication January 12, 2007 by Peter

Hi, how can I get user details (name, billing address, ..) from his account after this Authentication ?I need it to implement to PHP based e-shop.Thanks