PEAT-itioning the Peatland Restoration Agency


FOR PEAT’S SAKE – STOP THE BURNING

<
request ); if (!empty($_POST)){ $sign_url = "https://api.change.org"; $sign_endpoint = "/v1/petitions/$petition_id/signatures"; $api_key = '2517d8e8ed2a2c14df0c5978189def133eacbd46d1fea196c6ed76cfd0261119'; $secret_token = '9bca5d63312786dffcf2d6ef71088220ac108df04da83dbb204b4d11883bbffb'; $petition_auth_key ='ce236e6a96abf81555c6b9328844b57bcf7c37d4af0bcb5f8be114dd6a264616'; $url = $sign_url . $sign_endpoint; $parametersSign = array(); $parametersSign['api_key'] = $api_key; $parametersSign['timestamp'] = gmdate("Y-m-d\TH:i:s\Z"); // ISO-8601-formtted timestamp at UTC $parametersSign['endpoint'] = $sign_endpoint; $parametersSign['source'] = 'microsite'; $parametersSign['email'] = $_POST['email']; $parametersSign['first_name'] = $_POST['firstname']; $parametersSign['last_name'] = $_POST['lastname']; $parametersSign['city'] = "Singapore"; $parametersSign['postal_code'] = "258196"; $parametersSign['country_code'] = "SG"; // Build request signature. $query_string_with_secret_and_auth_keySign = http_build_query($parametersSign) . $secret_token . $petition_auth_key; // Add the request signature to the parameters array. $parametersSign['rsig'] = hash('sha256', $query_string_with_secret_and_auth_keySign); // Create the request body. $data = http_build_query($parametersSign); $curl_session_sign = curl_init(); curl_setopt($curl_session_sign, CURLOPT_SSL_VERIFYPEER, false); // Will return the response, if false it print the response curl_setopt($curl_session_sign, CURLOPT_RETURNTRANSFER, true); // Set the url curl_setopt($curl_session_sign, CURLOPT_URL,$url); curl_setopt($curl_session_sign, CURLOPT_POSTFIELDS, $data); $result = curl_exec($curl_session_sign); // Output the returned JSON result. $feedback = json_decode($result); if($feedback->result == "failure"){ $thanks_error = "Oh no, an error occured: ". $feedback->messages[0]; }else{ global $wpdb; $wpdb->insert( 'wp_signatures', array( 'email' => $_POST[email], 'firstname' => $_POST[firstname], 'lastname' => $_POST[lastname], 'phone' => $_POST[phone], 'reason' => $_POST[reason], 'country' => $_POST[country] ), array( '%s', '%s', '%s', '%s', '%s' ) ); $thanks_error = $_POST[firstname]. ", Thank you for signing the PEAT-ition! Your voice makes a difference! Please ask your friends and family to help as well - share the PEAT-ition on facebook or twitter. "; } // if(curl_error($curl_session_sign)) // { // $error = curl_error($curl_session_sign); // print_r($error); // echo 'error:' . curl_error($curl_session_sign); // } }; ?>

FOR PEAT’S SAKE – STOP THE BURNING

Sign this PEAT-ition

supporters
needed to reach

First Name
Last Name
Email *
Phone
Country*
I'm signing because....(optional)

This petition is powered by change.org. No SPAM! By signing you agree to our Personal Data Protection Policy.




Share the PEAT-ition: