Advertisement
Guest User

Untitled

a guest
Aug 1st, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1.  
  2.  
  3. add_action( 'gform_after_submission_6', 'send_sms', 10, 2 );
  4.  
  5. function send_to_third_party( $entry, $form ) {
  6.  
  7.     // Account details
  8.     $apiKey = urlencode('xxxxxxx');
  9.    
  10.     // Message details
  11.     $numbers = rgar( $entry, '8' );  // WORKS FINE!
  12.     $first_name = rgar( $entry, '24' ); // WORKS FINE!
  13.     $last_name = rgar( $entry, '25' );  // WORKS FINE!
  14.     $sale_price = rgar( $entry, '18' ); PRODUCT FIELD - NO VALUES
  15.     $sub_total = rgar( $entry, '17' ); // PRODUCT FIELD - NO VALUES
  16.     $message = rawurlencode('message');
  17.  
  18.     // Prepare data for POST request
  19.     $data = array('apikey' => $apiKey, 'numbers' => $numbers, "sender" => $sender, "message" => $message);
  20.  
  21.     // Send the POST request with cURL
  22.     $ch = curl_init('http://thirdparty.url');
  23.     curl_setopt($ch, CURLOPT_POST, true);
  24.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  25.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  26.     $response = curl_exec($ch);
  27.     curl_close($ch);
  28.    
  29.     // Process your response here
  30.     echo $response;
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement