Stargate22 Posted November 11, 2015 Share Posted November 11, 2015 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; } Quote Link to comment https://forums.phpfreaks.com/topic/299441-function-to-add-contacts-to-yahoo-mail/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.