Wednesday 8 August 2007

MSN Search API in PHP

Here's some code for accessing the MSN Live Search API from PHP. You can get a developer key here by going to Configure Applications, Create and Manage Application IDs. You'll need a Microsoft Passport to get your key.

You'll need the PHP5 SOAP library enabled (make sure

extension=php_soap.dll
is uncommented in your php.ini).

To run a search on MSN and scrape results, set up a variable called
$msnsoapkey
with your key in it as a string, then call this function with three parameters:

  1. A string of your query - "site:fish.com" or "seo ranter", for example

  2. How many results you'd like, up to a maximum of 50

  3. The offset for the start of results; 0 means give results from number 1 to $querysize; 100 means from 101 to 100+$querysize.




/////
// fetches from search.msn.com results for the query $query, using the API

function fetchMSNResults($query, $querysize, $offset) {
global $msnsoapkey;
static $msnsoap;

// only generate this WSDL proxy once
if (!isset($msnsoap)) {
$msnsoap = new soapclient("http://soap.search.msn.com/webservices.asmx?wsdl");
}

$request = array(
'Request' => array(
'AppID' => $msnsoapkey,
'Query' => $query,
'CultureInfo' => 'en-US',
'SafeSearch' => 'Off',
'Flags' => '',
'Requests' => array(
'SourceRequest' => array(
'Source' => 'Web',
'Offset' => $offset,
'Count' => $querysize,
'ResultFields' => 'Url'
)
)
)
);

$response = $msnsoap->Search($request);

foreach($response->Response->Responses->SourceResponse->Results->Result as $hit) {
$results[] = $hit->Url;
}

return $results;
}


It will return an Array() of Strings, each one containing a result URL. Easy! This is contained by a wrapper function in my code library, which manipulates the
$offset 
and
$querysize
to allow for any number of results to be returned at the courtesy of the MSN API; you can figure one out pretty easily if you need.

BuyBlogComments.com review

BuyBlogComments.com is a service launched in July 2007 and run by Jon Waraas, where you can pay to have someone leave relevant blog comments on a bunch of blogs in your industry, with an anchor text and URL of your choosing. This gives a mild SEO benefit (despite most blog comments having rel=nofollow applied) and a bit of traffic toward your site. Many people hire freelancers from the likes of Rent-A-Coder or Get-A-Freelancer to do this kind of work; some call it black hat, though in my opinion, that's a little rude; black hat's often much cleverer.

I tried out this service, with the smallest package of 100 comments for $19.99.

When you apply, the post-purchase page says you'll be contacted within 12-24 hours. Now, I dived in there making a purchase shortly after the launch of the service; I'm not sure why, but it took about 4 days of hearing plain silence before I started being a little concerned, whereupon I emailed Jon, who reassured me that they hadn't forgotten my order, and was appropriately apologetic.

Lo and behold, a few more days later, a spreadsheet arrived with 100 URLs to blog comments. Fantastic, I thought; that was easy and quick!

So, I decided to review this list, to see how BuyBlogComments.com has done. I was a little disappointed by the details; a bit more attention to quality and thoroughness would've saved a few mistakes. I waited one week after receiving the URL list before checking it, to allow bloggers to approve comments.

One of the things that BuyBlogComments.com really pushed themselves on was the relevance of blog comments - "What BuyBlogComments.Com does is pay people to write quality blog comments on quality blogs" - though I found really generic comments, such as "dana: truly valuable post" (that's the entire comment! see mikes5starstore.typepad.com). The reporting was also really unclear in places; sometimes the links led to blank pages, or just the blog homepage - this is tough when there are a lot of posts. For example, I was given this link - see if you can guess which post the comment's on:

http://sheabutterblog.blogspot.com/ (shea butter)
The entire blog is about "shea butter", with hundreds of posts!
At other times, there would be a link to a blog that's utterly irrelevant. I tested the system out with a fashion/apparel themed site; I got left this comment. The topic's not relevant (mattresses are not fashionable, despite what your local bed retailer thinks!), the grammar's bad, the spelling's actually off - how people manage to misspell commercial copywriting these days is beyond me - and the comment itself has had no thought applied to it.

BuyBlogComments.com also suggests that "They are hand written by excellent english (sic) speaking people in America and Canada. We have a really great system here at Buy Blog Comments." That may be true; I don't see any claim to having native English speakers, which might explain the low rate. Of course that's not a problem until grammar and spelling mistakes appear, which they do. I'd much rather have a guarantee that comments will be syntactically correct than a guarantee of the location of the posters.

Another thing I noticed was that some comment URLs were actually duplicated within the list. That's right, I only received 97 unique URLs. I contacted Jon about this (as well as a few other mistakes) and he didn't provide any kind of answer or compensation.

Anyway, my biggest problem was that 33 of the 97 comments simply were not there. There's a bit on the legal part of the Buyblogcomments.com site, which Jon kindly referred me to, that says they only guarantee the posting of comments, and not their approval. Doesn't this sound like a loophole to allow them to just give you 100 blog post URLs sans comment and say "well, we submitted one!"? I'm quite stunned at the failure rate and how badly blogs were chosen; some were obviously dead/slow blogs that were pointless to comment. A paid service should, at the very least, review these factors before commenting, to ensure a successful comment approval:

  1. Comment should contribute to the post
  2. Post should have been made within the past week
  3. Other comments on other posts should have been approved recently
  4. Post shouldn't say "I am going on holiday for a while"
  5. Comment should be grammatically correct and well-spelled
  6. Post should already have some approved comments


There were definite cases where one or more of these suggestions had been completely ignored. I voiced my opinions to Jon, and after hearing nothing for a week, kindly prodded him; he referred me to their legal page with reference to unapproved comments, and offered nothing more in the case of duplicate / irrelevant comments.

TypeQuantityComments
Dupes3Where one comment's URL has been listed twice as a "successful" comment
No URL1Comments where there's no link
No comment28Comment has not been approved / never submitted
Not relevant3Comments on irrelevant posts / blogs
OK56Successfully placed comments
Blank page1The comment URL goes to a blank page - broken site?
Ambiguous URL8Couldn't find the comment, URL was given to a large and busy blog instead of the individual post


I haven't reported on really short comments that bore no relevance; there were too many to account for, and BuyBlogComments.com already seemed to be doing so badly that I gave up trying to get this point corrected. They make up about 30%-40% of the comments that actually got published.

As for results: the site that was used for testing had an unusually great day for sales when the report arrived, easily making back the outlay on comments. However, we've seen less that 20 clicks to date from all the blog comments in total, over a four week period from placing the order. I'm not sure if the sales have any link to the comments; the referral URLs were from natural search and Wikipedia. There has been a small but noticeable boost for the term used for the blog comments, so that's a mild plus in favour of the service, too.

So, in summary;

Pros

  • Saves getting ones hands dirty with a freelancer
  • Delivery in under ten days
  • Cordial and professional support
  • Was cheap ($19.99 for "100" comments)
  • Possibly great for short term sales
  • Some SEO benefit
  • Site is easy to use

Cons

  • Almost 50% failure rate (only 56 out of 100 comments ever made it)
  • Comments are badly written (grammar and spelling mistakes)
  • Comments are often not relevant ("great post!" - a bot could apply this kind of content at a much lower rate; we're paying to avoid such a low quality level)
  • Not always applied to relevant blogs
  • Contact can be slow (took over a week from payment to delivery)
  • Some duplicate reporting means you won't even get as many comment submissions as you pay for(only 97 unique URLs were in my report, when there should've been 100)
  • Price has gone up ($24.99 for "100" comments; with the same success rate as I had, that's 45 cents a comment.)
  • Next to no traffic (would you click through to see the site behind comments this inconsequential?)


I won't be returning; the yield simply isn't high enough, and quality's not as expected.

 
Marketing & SEO Blogs - Blog Top Sites sitemap