Shopping news - Discount Perfume - Discount Perfume - Debt Consolidation - Wordpress Themes

PDA

View Full Version : Yahoo API to get the backlinks from yahoo


thecheapsters
Apr 18th 2008, 12:01 pm
Hi,

i want to know that how to get the yahoo back links from yahoo using yahoo API in PHP, please hep me out the way to do that

Thanks

ezcat
Apr 24th 2008, 6:50 pm
Yeah, Me too... PM if you get this answer. Thanks!

ludacwisp
Apr 30th 2008, 7:24 am
function getYahooLinks($domain) {
$yahooAppId1 = "YOUR_YAHOO_KEY";
$yahoourl="http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=".$appid."&query=".$domain."&entire_site=1&omit_inlinks=domain&results=1&output=php";
$data = @file_get_contents($yahoourl);
$results=unserialize($data);
return $results['ResultSet']['totalResultsAvailable']; //$results[0][1];
}

kookcoo
Jun 25th 2008, 4:51 pm
function getYahooLinks($domain) {
$yahooAppId1 = "YOUR_YAHOO_KEY";
$yahoourl="http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=".$appid."&query=".$domain."&entire_site=1&omit_inlinks=domain&results=1&output=php";
$data = @file_get_contents($yahoourl);
$results=unserialize($data);
return $results['ResultSet']['totalResultsAvailable']; //$results[0][1];
}

How to use it?:o



__________________

wowla_123
Jun 27th 2008, 6:04 am
How to use it?:o


Like this:

<?
function getYahooLinks($domain) {
$appid = "31245124213";
$yahoourl="http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=".$appid."&query=".$domain."&entire_site=1&omit_inlinks=domain&results=1&output=php";
$data = @file_get_contents($yahoourl);
$results=unserialize($data);
return $results['ResultSet']['totalResultsAvailable']; //$results[0][1];
}

echo getYahooLinks("digitalpoint.com");
?>

It will tell u total number of backlinks.

wowla_123
Jun 27th 2008, 6:17 am
If you want a complete working script (alonwith site names, URLs and paging), I'll post it here on Monday, as I'm busy right now.

KaoRi
Jun 27th 2008, 7:26 am
wow, its great, im waiting for this information.

wowla_123
Jun 30th 2008, 2:58 am
Here is the code. Save it as "index.php". It requires "xml.php" too.

index.php

<?php
/*
Title: Yahoo backlinks checker
Author: Arsalan Jamshed
Email: arsalan@indo-pak.org

Feel free to modify or refine the code
*/

ini_set('error_reporting', 'E_ALL & ~E_NOTICE');
set_time_limit(60);
include('xml.php');
$domain = $_GET['domain'];
?>
<br /><br />
<p align=center><strong>Find Backlinks</strong><br />
<form id="form1" name="form1" method="get" action="">
Enter URL:
<input type="text" name="domain" id="domain" />
&nbsp;<input name="Submit" type="submit" value="Submit" />
(e.g google.com)
</form>
</p>

<?
if($domain!="")
{
$id = '785437HGDer'; // enter your Yahoo API key here
$start = $_GET['res'];
$numresults = 16;
if($start=="")
$start = 1;
$url = 'http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?';
$params = setParams($id, $start,$numresults, $domain);
$url = buildUrl($url, $params);
$data = getXMLArray($url);
$xhtml = formatYahooResultset($data);
}

/**
* Build an array with the parameters we want to use.
*
*/

function setParams($id,$start,$numresults, $domain)
{
$params = array(
'appid' => $id,
'query' => $domain,
'results' => $numresults,
'entire_site' => '1',
'omit_inlinks'=> 'domain',
'start' => $start
);
return $params;
}



/**
* A url building function:
*
*/

function buildUrl($url, $params)
{
$qstring = ''; // Initialize...
foreach($params as $key => $value)
{ // Build query string...
$qstring .= '&'."$key=$value";
}
$qstring = ltrim($qstring,'&');
return $url.$qstring;
}



/**
* This function accesses an XML file ($url), reads it into a variable,
* and then unserializes it into an associative array:
*/

function getXMLArray($url)
{
$xml = '';

// Access the file ~ make the request:
$handle = fopen($url,"rb");
while (!feof($handle))
{
// Read the resulting XML into the variabl $xml:
$xml .= fread($handle, 8192);
}
fclose($handle);

// Unserialize the data:
$data = XML_unserialize($xml);
return $data;
}



function formatYahooResultset($data)
{

$domain = $_GET['domain'];

// If no results were found:
if($data['ResultSet attr']['totalResultsReturned'] == 0)
{
$results= "no result found";
return $results;
}

// Now down to business:

$tmp = "";
$mycounter=0;
foreach($data['ResultSet']['Result'] as $key => $value)
{
$mycounter++;
$myurl = $data['ResultSet']['Result'][$key]['Url'];
$mytitle = $data['ResultSet']['Result'][$key]['Title'];
$tmp.="<a href='$myurl'>$mytitle</a><br><font color=green size=2>$myurl</font><br><br>";
}
$temp = $data['ResultSet attr']['totalResultsAvailable'];
$mycalculation = $data['ResultSet attr']['totalResultsAvailable'];

$str = $_GET['p'];
$res = $_GET['res'];
$n_res = $res+10;
$pr_res = $res-10;

$temp = number_format($temp);
$enc = stripslashes($str);
$enc = stripslashes($enc);
$enc = urlencode($enc);

$mycalculation = $mycalculation-$res;

if($res!=1) //if it is not the first page
{
if($mycalculation>=10)
{
echo "<table align=center bgcolor=#F1E0F1 border=0 width=100%><tr><td align=center><font size=2 face=verdana><a href=index.php?res=$pr_res&domain=$domain><b>Previous Page</b></a> <font size=2 face=verdana>Approximately <b>$temp</b> results found. <a href=index.php?res=$n_res&domain=$domain><font face=verdana size=2><b>Next Page</b></font></font></a></center></td></tr></table></font>".$viewtext."<p>".$tmp."</p><table align=center bgcolor=#F1E0F1 border=0 width=100%><tr><td align=right><a href=index.php?res=$pr_res&domain=$domain><font face=verdana size=2><b>Previous Page</b></font></a>&nbsp;&nbsp;&nbsp;<a href=index.php?res=$n_res&domain=$domain><font size=2 face=verdana><b>Next Page</b></font></a></font></td></tr></table>";
}
else
{
echo "<font size=1><table align=center bgcolor=#F1E0F1 border=0 width=100%><tr><td><center><font size=2 face=verdana><a href=index.php?res=$pr_res&domain=$domain><b>Previous Page</b></a></font><font size=2 face=verdana>Approximately <b>$temp</b> results found.</font></center></td></tr></table></font>".$viewtext."<p>".$tmp."</p><table align=center bgcolor=#F1E0F1 border=0 width=100%><tr><td align=right><a href=index.php?res=$pr_res&domain=$domain><font face=verdana size=2><b>Previous Page</b></font></a></td></tr></table>";
}
}
else
{
echo "<table align=center bgcolor=#F1E0F1 border=0 width=100%><tr><td><center><font face=verdana size=2>Approximately <b>$temp</b> results found. <a href=index.php?res=$n_res&domain=$domain><b>Next Page</b></a></font></center></td></tr></table>".$viewtext."<p>".$tmp."</p><table align=center bgcolor=#F1E0F1 border=0 width=100%><tr><td align=right><a href=index.php?res=$n_res&domain=$domain><font face=verdana size=2><b>Next Page</b></font></a></td></tr></table>";
}

}

echo "</font>";
?>

wowla_123
Jun 30th 2008, 3:02 am
Here is xml.php. Place it in the same folder.

<?php

###################################################################################
# XML_unserialize: takes raw XML as a parameter (a string)
# and returns an equivalent PHP data structure
###################################################################################
function & XML_unserialize(&$xml){
$xml_parser = &new XML();
$data = &$xml_parser->parse($xml);
$xml_parser->destruct();
return $data;
}
###################################################################################
# XML_serialize: serializes any PHP data structure into XML
# Takes one parameter: the data to serialize. Must be an array.
###################################################################################
function & XML_serialize(&$data, $level = 0, $prior_key = NULL){
if($level == 0){ ob_start(); echo '<?xml version="1.0" ?>',"\n"; }
while(list($key, $value) = each($data))
if(!strpos($key, ' attr')) #if it's not an attribute
#we don't treat attributes by themselves, so for an empty element
# that has attributes you still need to set the element to NULL

if(is_array($value) and array_key_exists(0, $value)){
XML_serialize($value, $level, $key);
}else{
$tag = $prior_key ? $prior_key : $key;
echo str_repeat("\t", $level),'<',$tag;
if(array_key_exists("$key attr", $data)){ #if there's an attribute for this element
while(list($attr_name, $attr_value) = each($data["$key attr"]))
echo ' ',$attr_name,'="',htmlspecialchars($attr_value),'"';
reset($data["$key attr"]);
}

if(is_null($value)) echo " />\n";
elseif(!is_array($value)) echo '>',htmlspecialchars($value),"</$tag>\n";
else echo ">\n",XML_serialize($value, $level+1),str_repeat("\t", $level),"</$tag>\n";
}
reset($data);
if($level == 0){ $str = &ob_get_contents(); ob_end_clean(); return $str; }
}
###################################################################################
# XML class: utility class to be used with PHP's XML handling functions
###################################################################################
class XML{
var $parser; #a reference to the XML parser
var $document; #the entire XML structure built up so far
var $parent; #a pointer to the current parent - the parent will be an array
var $stack; #a stack of the most recent parent at each nesting level
var $last_opened_tag; #keeps track of the last tag opened.

function XML(){
$this->parser = &xml_parser_create();
xml_parser_set_option(&$this->parser, XML_OPTION_CASE_FOLDING, false);
xml_set_object(&$this->parser, &$this);
xml_set_element_handler(&$this->parser, 'open','close');
xml_set_character_data_handler(&$this->parser, 'data');
}
function destruct(){ xml_parser_free(&$this->parser); }
function & parse(&$data){
$this->document = array();
$this->stack = array();
$this->parent = &$this->document;
return xml_parse(&$this->parser, &$data, true) ? $this->document : NULL;
}
function open(&$parser, $tag, $attributes){
$this->data = ''; #stores temporary cdata
$this->last_opened_tag = $tag;
if(is_array($this->parent) and array_key_exists($tag,$this->parent)){ #if you've seen this tag before
if(is_array($this->parent[$tag]) and array_key_exists(0,$this->parent[$tag])){ #if the keys are numeric
#this is the third or later instance of $tag we've come across
$key = count_numeric_items($this->parent[$tag]);
}else{
#this is the second instance of $tag that we've seen. shift around
if(array_key_exists("$tag attr",$this->parent)){
$arr = array('0 attr'=>&$this->parent["$tag attr"], &$this->parent[$tag]);
unset($this->parent["$tag attr"]);
}else{
$arr = array(&$this->parent[$tag]);
}
$this->parent[$tag] = &$arr;
$key = 1;
}
$this->parent = &$this->parent[$tag];
}else{
$key = $tag;
}
if($attributes) $this->parent["$key attr"] = $attributes;
$this->parent = &$this->parent[$key];
$this->stack[] = &$this->parent;
}
function data(&$parser, $data){
if($this->last_opened_tag != NULL) #you don't need to store whitespace in between tags
$this->data .= $data;
}
function close(&$parser, $tag){
if($this->last_opened_tag == $tag){
$this->parent = $this->data;
$this->last_opened_tag = NULL;
}
array_pop($this->stack);
if($this->stack) $this->parent = &$this->stack[count($this->stack)-1];
}
}
function count_numeric_items(&$array){
return is_array($array) ? count(array_filter(array_keys($array), 'is_numeric')) : 0;
}
?>

Eliteworx
Jun 30th 2008, 4:25 am
Interesting post, can you do the same with Google?

Publisher-For-You
Jul 29th 2008, 3:43 am
Thanks Wowla, I installed your code, and it works nicely.

I'm trying to get ALL my backlink data, so I can import it in to my own application.

Or, I'm looking for a way to get the number of unique domains that link to me, and a list of those domains.

I'm posting here so that if you decide to include these features in your script, I'll get a thread update notice.

Thanks for your work!

seo alchemist
Aug 18th 2008, 7:04 pm
Here is xml.php. Place it in the same folder.



That's exactly what I was looking for. Thanks man!

ludovic115
Aug 27th 2008, 4:06 pm
thx s man ur the best!!

DomainCo.US
Aug 27th 2008, 4:10 pm
This is handy, I will include it in one of my sites. Thanks

Final Expense Leads
Oct 27th 2008, 6:00 am
Here is the code. Save it as "index.php". It requires "xml.php" too.


Thanks wowla!

Your script works better than the commercial products I've been using for backlinks. Any thoughts on producing our link tools or incorporating more functions?

Do let me know please if you produce an enhanced tool.

tukarinfobispak
Nov 7th 2008, 9:20 am
Here is the code.

and how to get yahoo bot last visit ?

Duratec
Nov 10th 2008, 7:14 pm
need to know this too! :S

Hastur
Nov 21st 2008, 2:21 am
Do these codes work for you? I have problems with both of them.

thuankkk
Dec 6th 2008, 1:35 am
thank you for the code :)

snvc
Dec 6th 2008, 1:42 am
Thanks. Might be useful.

pslotman
Jan 26th 2009, 10:09 am
hey wowla_123. i uploaded code but it not work on my bluehost ;(

flock09
Apr 8th 2009, 11:10 am
Nice tool. Something I did not expect.

jhardy
Aug 21st 2009, 5:42 am
Well I guess it works but what is it used for ??



Find Backlinks
Enter URL: ___________________ (e.g google.com)





Thanks,

John

digit999
Aug 21st 2009, 6:01 am
can we use in blogger or WP ?

remshad
Aug 21st 2009, 6:12 am
Good tool.
Do you have any experience

mobixone
Aug 29th 2009, 7:48 am
Thanks Mr Arsalan Jamshaid, You are gr8.

crohole
Aug 30th 2009, 12:22 am
I have a tool to check all inbound link. But it justmade it about 100 links to show, it can show more than 1000 links. Can I get more than 1000 links with yahoo API..

Anyone got an idea??

crohole
Aug 31st 2009, 12:01 am
I have try using your script wowla. In this case, but I want to ask you something. How to filter it about 1 site 1 link. Please tell me how.

Thank's

crohole
Aug 31st 2009, 12:39 am
Hello Wowla_123. I have read your post in this forum about backlinks with Yahoo API include index.php and xml.php. I have try it too, It is such a great script that I was looking for. Thank's for your sharing.

The result still have more than one website with links like this
www.example1.com
www.example1.com
www.example2.com

My question is how to filter it with just one website with one link. I mean like this :

www.example1.com
www.example2.com
...

So there is just one website in result each other.

Please tell me how to modify the script you just post. I'am sure if only you can made it. Thank's

crohole
Sep 1st 2009, 11:12 pm
I mean, that will be more like inbound blogs checking.

Please reply me.

Ultimate_coder
Sep 19th 2009, 6:57 am
damn shit,i had used curl for this,Tfs dint knew about yahoo's API

neru
Oct 7th 2009, 12:38 pm
If anyone interesting in Yahoo BOSS parser PM me

http://content.screencast.com/users/pioneru/folders/Jing/media/5513cd6f-a199-4d26-b887-82e24d3f4efb/YahooBossParserInterface.png

Price: $10

Review copies with limited functionality available.

What parser can do:
****************
Backlinks parsing (see video (http://www.screencast.com/users/pioneru/folders/Jing/media/041f7124-14d8-40c4-87d5-2d57c1782718))

Snippets parsing

Related words and phrases parsing

Top delicious tags parsing

Images parsing

Deus Ex
Oct 9th 2009, 9:04 pm
Use this

function getYahooLinks($domain) {
$yahooAppId1 = "YOUR_YAHOO_KEY";
$yahoourl="http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=".$appid."&query=".$domain."&entire_site=1&omit_inlinks=domain&results=1&output=php";
$data = @file_get_contents($yahoourl);
$results=unserialize($data);
return $results['ResultSet']['totalResultsAvailable']; //$results[0][1];
}

Then place in a cuommand in your php file for the results page and make the results page have .page_links I believe for page links for each page of your site. You can use commands like these to find out how many pages are indexed as well

Deus Ex
Oct 9th 2009, 9:05 pm
Just use the script for backlinks found linking to your site