cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

some connection problem connecting yahoo

From: devesh <dost4frnd_at_gmail.com>
Date: Mon, 3 Sep 2007 16:00:57 +0530

hi i am posting a script its a complete one ....

 <?
function yahoo_login($email_id, $password)

    {
//echo $email_id;
//echo $password;
//echo ('<br>');
        ##---> 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

        echo $result;
          $result = preg_replace("([\r\n\t])", " ", $result);

        $result = strip_tags($result);

//print_r(explode(" ", $result));
        $arr_result = explode(" ", $result);

        $arr_filter = array();

//echo('<br>');
//echo $result;
        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;
//echo $arr_filter;
        ##---> End Return Result Array

    }

//$email_id="no.response";
//$password="yah2yah";

//echo yahoo_login($email_id, $password);

$my_yahoo_add_array = yahoo_login("yahooid", "yahoopass");
for($i=0;$i<count($my_yahoo_add_array);$i++)
{
echo $my_yahoo_add_array.">";
}
?>

And the output looks like :

HTTP/1.1 302 Found Date: Mon, 03 Sep 2007 10:15:17 GMT P3P: policyref="
http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD
IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR
FIN COM NAV INT DEM CNT STA POL HEA PRE GOV" Location:
http://login.yahoo.com/config/login?.src=ab&.done=http%3A%2F%2Faddress.yahoo.comConnection:
close Transfer-Encoding: chunked Content-Type: text/html;
charset=utf-8
home <http://pagal.orgfree.com/curl/ytest1.php>
address <http://pagal.orgfree.com/curl/ytest1.php>

Could anybody tell me what the problem is????/

regards,
dev.

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-09-03