
01-30-2006, 12:54 PM
|
 |
SEO
|
|
Join Date: May 2005
Location: England, UK
Posts: 621

|
|
|
Online Ranking Checks on Google, Yahoo and MSN
Hi!
I've been writing some ASP code to allow our clients to check their rankings fast and easily online through our website. I've integrated Google API, using SOAP and an XML parser, Yahoo API using REST, (they both work like a dream!) but I'm a little stuck on the MSN API, which is SOAP again, but it's a bit trickier than the other two were.
Has anyone here managed to do it? I think my only real problem is the correct format of the SOAP envelope which I construct using XMLDocument:
A snippet from the main function:
Code:
Function MSNResults(gQuery)
If Trim(gQuery) = "" Then Exit Function
Dim Qry
Set Qry = Server.CreateObject("MSXML2.DOMDocument")
Qry.load Server.MapPath("doMSNSearch.xml")
Qry.selectSingleNode("//Query").Text = gQuery
' Post the SOAP message.
Dim soap
Set soap = Server.CreateObject("MSXML2.ServerXMLHTTP")
soap.open "post", MSNAPI, False
soap.setRequestHeader "Content-Type", "text/xml"
soap.setRequestHeader "SOAPAction", "doMSNSearch"
soap.send Qry ' Dump the results into an XML document.
.
.
.
End Function
Below is what I have of my SOAP envelope so far. It's missing 2 critical bits though. Requests, and SourceRequest. But for the life of me I don't know how to add them - the right format, etc. (XML is not a strength of mine!)
Code:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:doMSNSearch xmlns:ns1="urn:MSNSearch"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<AppID xsi:type="xsd:string">API Key Goes Here</AppID>
<Query xsi:type="xsd:string">Search Terms Here</Query>
<CultureInfo xsi:type="xsd:string">en-GB</CultureInfo>
<SafeSearch xsi:type="xsd:string">Off</SafeSearch>
</ns1:doMSNSearch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Help... anyone?
Last edited by BSolveIT : 02-02-2006 at 06:36 AM.
|