using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Net;
using System.IO;
namespace BLL
{
public class Alexa
{
public static int GetAlexa(string host)
{
string html = Net.GetHtml("http://data.alexa.com/data/?cli=10&dat=snba&ver=7.0&url=" + host);
try
{
XmlDocument xml = new XmlDocument();
xml.LoadXml(html);
XmlNode node = xml.SelectSingleNode("/ALEXA/SD/POPULARITY");
if (node != null && node.Attributes["TEXT"] != null)
return int.Parse(node.Attributes["TEXT"].Value);
}
catch
{
int a = html.IndexOf("RANK=\"");
if (a > 0)
{
int b = html.IndexOf("\"", a+6);
if (b>0)
return int.Parse(html.Substring(a+6, b-a-6));
}
}
return 0;
}
}
}
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Net;
using System.IO;
namespace BLL
{
public class Alexa
{
public static int GetAlexa(string host)
{
string html = Net.GetHtml("http://data.alexa.com/data/?cli=10&dat=snba&ver=7.0&url=" + host);
try
{
XmlDocument xml = new XmlDocument();
xml.LoadXml(html);
XmlNode node = xml.SelectSingleNode("/ALEXA/SD/POPULARITY");
if (node != null && node.Attributes["TEXT"] != null)
return int.Parse(node.Attributes["TEXT"].Value);
}
catch
{
int a = html.IndexOf("RANK=\"");
if (a > 0)
{
int b = html.IndexOf("\"", a+6);
if (b>0)
return int.Parse(html.Substring(a+6, b-a-6));
}
}
return 0;
}
}
}