XML Profile Data

← Back

XML is a universal, structured data-encoding format, which is accessible via most programming languages. All open profile data may be accessed very easily using a simple XML format.

Base Request

Making an XML request is likely to follow these steps (assuming you have an email address already):

  1. Create a valid email hash
  2. Build the URL to request a profile page
  3. Append .xml to that URL to indicate that you want the results in XML format



When you request that URL (you can do it in your browser) you should get an XML document containing all open profile data. We use Portable Contacts to format our profile data whereever possible, so see the PoCo spec for more details on the structure of the response.

Request Options

The XML data format does not support any additional options


This example (written in PHP 5.2+, and assuming you can file_get_contents() and use SimpleXML) just loads up my profile in XML, queries my name via XPath and then outputs it:


	$str = file_get_contents( 'https://www.gravatar.com/205e460b479e2e5b48aec07710c08d50.xml' );
	$xml = simplexml_load_string( $str );
	$names = $xml->xpath( '//entry/displayName' );
	if ( is_array( $names ) && isset( $names[0] ) )
		echo (string) $names[0];



  1. Some fields within a profile may contain line breaks and other characters which are encoded in the XML output. Be sure to decode any characters before using the data.