XML Profile Data

← Back

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

Once you have done the above, you should end up with a URL that looks something like this:

https://www.gravatar.com/205e460b479e2e5b48aec07710c08d50.xml

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

Request Options

The XML data format does not support any additional options

Example

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:

	<?php

	$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];

	?>

Tips

  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.
  2. Links (a href) within the "Description" field are automatically modified to include rel="nofollow" on profile pages, but the raw profile data does not have this change applied.
  3. As with all profile data formats, profile requests will only resolve for the hash of the primary address on an account. Users may have multiple addresses on a single account, so while a Gravatar image request may return a result, a profile request for the same hash may not.
上海时时乐 湖南快乐十分走势 小米彩票网址 幸运时时彩 北京pk10 幸运时时彩 大资本平台 吉林快3代理 小米彩票手机app下载 福建泰顺棋牌俱乐部