Question

Locked

Geting Yahoo Address Book

By rashed_forum ·
i have collect a sample code of accessing yahoo address book from this site. The full code given below,
------------------------
<?
##Here is the solution for yahoo address book import. Please send me a thanks mail if this code works for you. My Email ID is: kailashag@xponse.com

##---------------------------------------------##
## Script Utility: Import Yahoo Address Book.
## Author Name: Kailash Agarwal.
## Author Email: kailashag@xponse.com
##---------------------------------------------##

function yahoo_login($email_id, $password)
{
##---> Create URL
$url = "https://login.yahoo.com/config/login?";
$query_string = ".tries=2&.src=ym&.md5=&.hash=&.js=&.last=&promo=&.intl=us&.bypass=&.partner=&.u=4eo6isd23l8r3&.v=0&.challenge=gsMsEcoZP7km3N3NeI4mXkGB7zMV&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=1&.chkP=Y&.done=http%3A%2F%2Fmail.yahoo.com&login=$email_id&passwd=$password";
$url_login = $url . $query_string;
##---> End Create URL

##---> Execute Curl For Login
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url_login);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_HEADER , 1);
ob_start();
$response = curl_exec ($ch);
ob_end_clean();
curl_close ($ch);
unset($ch);
##---> End Execute Curl For Login

##---> Call Address Book Page Through Curl
$url_addressbook = "http://address.yahoo.com/yab/us";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_HEADER , 1);
curl_setopt($ch, CURLOPT_URL, $url_addressbook);
$result = curl_exec ($ch);
curl_close ($ch);
unset($ch);
##---> End Call Address Book Page Through Curl

##---> Manuplate String
$result = preg_replace("([\r\n\t])", " ", $result);
$result = strip_tags($result);
$arr_result = explode(" ", $result);

$arr_filter = array();
for($i=0; $i<sizeof($arr_result); $i++)
{
if(strpos($arr_result[$i], '@') > 0 && strpos($arr_result[$i], '.') > 0)
{
if(!in_array($arr_result[$i], $arr_filter, TRUE))
$arr_filter[] = $arr_result[$i];
}
}
##---> End Manuplate String

##---> Return Result Array
return $arr_filter;
##---> End Return Result Array
}
?>


<?
// This Code Portion is Use to see Is It Really working..?

$my_yahoo_add_array = yahoo_login("myAccount@yahoo.com", "123456");
for($i=0;$i<count($my_yahoo_add_array);$i++)
{
echo $my_yahoo_add_array."<br>";
}
?>
------------------------

But the problem is that, when i run it, its display fatal error(below) at line no 19,

"Fatal error: Call to undefined function: curl_init() in c:\apache\htdocs\myaddbook.php on line 19"

the line 19 contain the following code,

"$ch = curl_init();"

just tell me that does this error means, how shuould i correct this.
------------------------------- Rashed

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums