wordpress - Create a subscriber using AWeber -


i trying make post request aweber service create subscriber: https://labs.aweber.com/docs/reference/1.0#subscriber_collection. using wordpress (php) generate request it's not working. have been successful in getting account , list aweber account using requests not sure why struggling hard post request.

i finding aweber documentation pretty poor , examples revolve around sdk not keen on using application bare bones , want learn mechanics of things.

below code. you'll have trust me variables supplying code correct, , know have tested each 1 individually. there's else wrong doing. appreciated!

//here getting users authorization code gets generated when connect application. splitting information other data creating nonce , timestamp request. pretty confident data here fine because used successfuly requests $authorizationcode = $options['gotowebinar_aweber_authorization_code']; $separatedata = explode("|",$authorizationcode); $applicationkey = $separatedata[0]; $applicationsecret = $separatedata[1]; $nonce = wp_create_nonce('aweber'); $unixtimestamp = time();   //here building string encoded , turned oauth1 signature $signaturebasestring = 'oauth_consumer_key='; $signaturebasestring .= $applicationkey; $signaturebasestring .= '&oauth_nonce='; $signaturebasestring .= $nonce; $signaturebasestring .= '&oauth_signature_method=hmac-sha1&oauth_timestamp='; $signaturebasestring .= $unixtimestamp; $signaturebasestring .= '&oauth_token='; $signaturebasestring .= $options['gotowebinar_aweber_token']; $signaturebasestring .= '&oauth_version=1.0';  $url = 'https://api.aweber.com/1.0/accounts/'.$options['gotowebinar_aweber_accounts'].'/lists/'.$aweberlist.'/subscribers';  $signaturebasestring = 'post&'.urlencode($url).'&'.urlencode($signaturebasestring);  //here creating signature key combination of application secret , users token secret. once again think right should same request $sigkey = $applicationsecret.'&'.$options['gotowebinar_aweber_token_secret'];  //here creating final signature combining encoded string , signature key $signature = base64_encode(hash_hmac('sha1', $signaturebasestring, $sigkey, true));  //here creating body of request sample data         $json = json_encode(array(     'ws.op' => 'create',     'name' => 'michael smith',     'email' => 'michael@smith.com' ));  //now doing request $response = wp_remote_post($url, array(     'headers' => array(         'authorization' => 'oauth oauth_consumer_key="'.$applicationkey.'", oauth_nonce="'.$nonce.'", oauth_signature="'.$signature.'", oauth_signature_method="hmac-sha1", oauth_timestamp="'.$unixtimestamp.'", oauth_token="'.$options['gotowebinar_aweber_token'].'", oauth_version="1.0"',         'content-type' => 'application/json; charset=utf-8',     ),     'body' => $json, )); 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -