Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'gform_after_submission_6', 'send_sms', 10, 2 );
- function send_to_third_party( $entry, $form ) {
- // Account details
- $apiKey = urlencode('xxxxxxx');
- // Message details
- $numbers = rgar( $entry, '8' ); // WORKS FINE!
- $first_name = rgar( $entry, '24' ); // WORKS FINE!
- $last_name = rgar( $entry, '25' ); // WORKS FINE!
- $sale_price = rgar( $entry, '18' ); PRODUCT FIELD - NO VALUES
- $sub_total = rgar( $entry, '17' ); // PRODUCT FIELD - NO VALUES
- $message = rawurlencode('message');
- // Prepare data for POST request
- $data = array('apikey' => $apiKey, 'numbers' => $numbers, "sender" => $sender, "message" => $message);
- // Send the POST request with cURL
- $ch = curl_init('http://thirdparty.url');
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $response = curl_exec($ch);
- curl_close($ch);
- // Process your response here
- echo $response;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement