Jump to content


Ted k'

Member Since 03/12/2007
Offline Last Active 10/01/2012, 17:24
-----

#976190 Api Para Ver Os Dados Do Usuário Do Twitter

Posted by Ted k' on 03/08/2009, 16:19

<%
class UserTwitter
private objXMLDOM
private raiz, i
public nome, screen_name, location
public profile_image_url, url
public followers_count, friends_count
public favourites_count, statuses_count
public time_zone, profile_background_color
public profile_text_color, profile_link_color
public profile_sidebar_fill_color, profile_sidebar_border_color
public profile_background_image_url

public sub LerXML()
set objXMLDOM = server.createObject("MSXML2.DOMDocument.3.0")
objXMLDOM.async = false
objXMLDOM.setProperty "ServerHTTPRequest", true
objXMLDOM.validateOnParse = false
objXMLDOM.load("http://twitter.com/users/show/"&request.queryString("username")&".xml")

set raiz = objXMLDOM.getElementsByTagName("*")

for i = 0 to raiz.length - 1
select case (raiz.item(i).nodeName)
case ("name") 							: tw.nome 							= raiz.item(i).text
case ("screen_name") 					: tw.screen_name 					= raiz.item(i).text
case ("location") 						: tw.location 						= raiz.item(i).text
case ("profile_image_url") 				: tw.profile_image_url 				= raiz.item(i).text
case ("url") 							: tw.url 							= raiz.item(i).text
case ("followers_count") 				: tw.followers_count 				= raiz.item(i).text
case ("friends_count") 					: tw.friends_count 					= raiz.item(i).text
case ("favourites_count") 				: tw.favourites_count 				= raiz.item(i).text
case ("statuses_count") 				: tw.statuses_count 				= raiz.item(i).text
case ("time_zone") 						: tw.time_zone 						= raiz.item(i).text
case ("profile_background_image_url")	: tw.profile_background_image_url	= raiz.item(i).text
case ("profile_background_color") 		: tw.profile_background_color 		= ucase(raiz.item(i).text)
case ("profile_text_color")				: tw.profile_text_color				= ucase(raiz.item(i).text)
case ("profile_link_color")				: tw.profile_link_color				= ucase(raiz.item(i).text)
case ("profile_sidebar_fill_color") 	: tw.profile_sidebar_fill_color 	= ucase(raiz.item(i).text)
case ("profile_sidebar_border_color") 	: tw.profile_sidebar_border_color 	= ucase(raiz.item(i).text)
end select
next
set objXMLDOM = nothing
end sub

end class

set tw = new UserTwitter
tw.LerXML()
%>

Resultado:
Posted Image

Fonte:
http://tedk.com.br/b...rio-do-twitter/


#943143 Carregar Uma Página Dentro De Uma Div Com Ajax

Posted by Ted k' on 23/10/2008, 16:44

Carregamento simples de uma página dentro de uma DIV usando AJAX
Primeiro criamos o arquivo onde fazemos a solicitação do browser, para saber se o navegador suporta ou não “Msxml2.XMLHTTP”

ajax.js
function GetXMLHttp() {
	var xmlHttp;
	try {
		xmlHttp = new XMLHttpRequest();
	}
	catch(ee) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e) {
				xmlHttp = false;
			}
		}
	}
	return xmlHttp;
}

var xmlRequest = GetXMLHttp();

No arquivo “instrucao.js” terá as informações necessárias para fazer a ação

instrucao.js
function abrirPag(valor){
	var url = valor;

	xmlRequest.onreadystatechange = mudancaEstado;
	xmlRequest.open("GET",url,true);
	xmlRequest.send(null);

		if (xmlRequest.readyState == 1) {
			document.getElementById("conteudo_mostrar").innerHTML = "<img src='loader.gif'>";
		}

	return url;
}

function mudancaEstado(){
	if (xmlRequest.readyState == 4){
		document.getElementById("conteudo_mostrar").innerHTML = xmlRequest.responseText;
	}
}

Criamos a página Index.html para recerber as informações

Index.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Carregando Página em DIV / AJAX</title>
<script language="javascript" src="ajax.js"></script>
<script language="javascript" src="instrucao.js"></script>
</head>
<body>
	<div id="menu"><a href="#" onclick="abrirPag('Conteudo.html');">Clientes</a></div>
		<br><br>
	<div id="conteudo_mostrar"></div>
</body>
</html>

E finalmente criamos a página Conteudo.html que será exibida dentro da DIV “conteudo_mostrar”

Conteudo.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Clientes</title>
</head>
<body>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</body>
</html>

Qualquer dúvida postem!!
Abraços!!!!


IPB Skin By Virteq