XML data inside your webpage
How to use the data you get with the data API inside your webpage.
With the code below you will get the profilepicture and the first- lastname from the logged in user.
To get the information you need find out the structure of the XML page. You will find examples on this page.
Example:
// Use the parameter ha_responsefield to get the profilepicture - Optional parameter $responsefields = "profilepicture"; // Execute the API call with all the required parameters $oXml = $oGenusApis->doMethod("users.getLoggedin", array("ha_responsefields"=>$responsefields),$oAccessToken); // Use the result of the API call and store them for later use $profile_picture = $oXml->user->profilepicture->icon_medium->src; $firstname = $oXml->user->firstname; $lastname = $oXml->user->lastname; // Show an profilepicture from the logged in user in the middle of your webpage. echo "<center>"; echo "<img src='". $profile_picture ."' width='100px' height='100px'></img><br>"; echo "Hello " .$firstname ." " .$lastname; echo "</center>";
This example uses the OAuth authorization example and the GenusApis PHP library.
Click here to see a live example and download the source code.