hola a todos
este webservice jala los contactos del messenger
pero el problema es ke esta hecho en php,
alguien podria convertirlo a asp para poder usarlo en mi server windows?
gracias
usa dos archivos
msn_webservice_user.class.php Código PHP:
<?php
class MSN_contacts {
//Internal variables
var $username;
var $password;
var $raw_results;
var $parsed_results;
//This one function brings all the rest together
function qGrab ($username, $password) {
//Set username and password
$this->username = $username;
$this->password = $password;
//Get results
$this->connect();
//Parse results
$this->parse_results();
//Finally return the results
return $this->parsed_results;
}
//Get results from web service
function connect () {
//Construct the url
$url = "http://jmstreet.info/tools/msn_contact_grab/webservice.php";
$url .= "?username=" . $this->username;
$url .= "&password=" . $this->password;
//Connect to web service
//$fd = fopen($url, "r");
$fstring = file_get_contents($url);
$this->raw_results = $fstring;
}
//This function takes the raw results from the
//web service and parses them into an array
function parse_results () {
$xml = $this->raw_results;
$regex = "/<contact>[\n\t]+(<email>(.+?)<\/email>[\n\t]+<screenname>(.+?)<\/screenname>)[\n\t]+<\/contact>[\n\t]+/s";
preg_match_all($regex, $xml, $results);
$this->parsed_results = array(0 => $results[2],
1 => $results[3]);
}
}
?>
msn_webservice_usage.php Código PHP:
<?php
require "msn_webservice_user.class.php";
$msn_ws = new MSN_contacts;
/*
Slow way of doing things
$msn_ws->username = "YOUR USERNAME HERE";
$msn_ws->password = "YOUR PASSWORD HERE";
$msn_ws->connect();
$msn_ws->parse_results();
*/
//Faster method
$results = $msn_ws->qGrab("YOUR USERNAME HERE", "YOUR PASSWORD HERE");
echo "<table border='1'>\n";
$x = 0;
while ($x < count($results[0])) {
echo "<tr><td>\n";
echo $results[0][$x];
echo "</td><td>\n";
echo $results[1][$x];
echo "</td></tr>\n";
$x++;
}
echo "</table>";
?>