Jump to content

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 comment
https://forums.phpfreaks.com/topic/299441-function-to-add-contacts-to-yahoo-mail/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.