Formulate a Request to Yahoo Inlinks API
It is a wise programming strategy to report all errors, so the first line before communicating to the API is this one:
error_reporting(E_ALL);
To formulate the request, we need values for the following API variables, which we can obtain from user form input processing discussed in part two:
1.) appid = OUiTAC3V35FlhDKeOScqpmw42RTY8B4BI8VUI7kB6sczVWIjJxr45D3QRWcNOPeQ--
You should have your own API ID that can be obtained here: http://developer.yahoo.com/search/siteexplorer/
2.) query= http://www.thisisyourrootdomainurl.com
Query variables are the root domain URL.
3.) omit_inlinks=domain
This is the default, and cannot be obtained from form processing. Equating it to “domain” means that the API will exclude inlinks data from the same domain as the queried domain. This will ensure that all back links reported come from outside the domain.
4.) entire_site=userinputoptions
Possible values include 1 to get back link results pointing to the entire site, or “” (empty), to get back link results pointing only to that specific URL.
5.) results=100
As discussed in the first two parts, the Yahoo API can only provide a maximum of 100 back link URLs. So we say that we want the result variable to return the maximum number (100).
6.) output=php
This means that the Yahoo API will format the output in a serialized PHP array. You can learn about serialized PHP arrays in greater detail at the link.:
In PHP, the request URL to API in GET statements structure will be formulated as follows (incorporating all six API variables discussed above as a single GET request):
$request = 'http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid= OUiTAC3V35FlhDKeOScqpmw42RTY8B4BI8VUI7kB6sczVWIjJxr45D3QRWcNOPeQ--&query='.$domainurl.'&results=100&output=php&omit_inlinks= domain&entire_site='.$options;
blog comments powered by Disqus |
|
|
|
|
|
|
|