Access twitter profile by AJAX JQuery and XML

Posted By: Matpal - June 27, 2011
Jquery has a powerful library that can perform rich internet actions like AJAX and parsing the XML. We will use the same capability of Jquery for getting user profile of any twitter user.

Step 1 : Write a PHP file profile.php with following content

header ("Content-Type:text/xml");
echo $xml;

Step 2 : Write a simple profile.html to consume the XML

<script src="" type="text/javascript">
<script type="text/javascript">
    type: "GET",
    url: "profile.php",
    dataType: "xml",
    success: parseXml


function parseXml(xml)
$("#output").append("<img src='"+$(this).find("profile_image_url").text()+"'/><br/>");
$("#output").append("("+$(this).find("screen_name").text() + ")<br />");
$("#output").append($(this).find("name").text() + "<br />");
$("#output").append($(this).find("description").text() + "<br />");



<div id='output'>


Post a Comment

Note: Only a member of this blog may post a comment.