Jump to content

Function to add contacts to yahoo mail


Stargate22

Recommended Posts

Hello Guys,

 

I am trying to create a function to add contacts to the yahoo mailbox im stuck at posting the contacts and saving them :(

I need to create function postcontact in order to post and save the on yahoo. How should I do that?

    public function addcontact()
    {
        if (!$this->loggedin)
        {
            $this->Error = 'You must be logged in first';
            return false;
        }
        if (!is_file(ISD_ROOT . '/tmp/camps/' . $this->oferta . '/fromlines.txt'))
        {
            $this->Error = 'No fromlines file' . ISD_ROOT . '/tmp/camps/' . $this->oferta . '/fromlines.txt';
            return false;
        }
        if (!is_file(ISD_ROOT . '/domains.txt'))
        {
            $this->Error = 'No domains file';
            return false;
        }
        $fromlines = @SPUtils::readdata(ISD_ROOT . '/tmp/camps/' . $this->oferta . '/fromlines.txt');
        foreach($fromlines as $a=>$b){
            $nla = $fromlines[array_rand($fromlines, 1)];
            $froms[]=str_replace(' ','.',$nla);
        }

        $domains = @SPUtils::readdata(ISD_ROOT . '/domains.txt');
        $fromm = str_replace(' ', '.', $nla);
        foreach ($domains as $k => $l)
        {
            foreach($froms as $k=>$v){
                $contact_fields[] = array('type' => 'email', 'value' => $v . '@' . trim($l));
            }
        }
        $fromname = explode(' ', $nla, 2);
        $contact_fields[] = array('type' => 'name', 'value' => array('givenName' => $fromname[0], 'familyName' => (string )$fromname[1]));
        $contact = array('fields' => $contact_fields);
        $data = array('contact' => $contact);
        $body = json_encode($data);
        $resp = $this->generatetokens();
        parse_str($resp);
        var_dump($$body);
        $retarr = postcontact($this->OAuthConsumerKey, $this->OAuthConsumerSecret, $xoauth_yahoo_guid, $oauth_token, $oauth_token_secret, $body, true, true);
        return true;
    }
Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.