hollosipeter

Untitled

May 19th, 2023
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | Source Code | 0 0
  1. $entry_id = Forminator_API::add_form_entry( $form_id, $entry_meta );
  2.  
  3. if ($entry_id) {
  4.     $admin_url = admin_url('admin-post.php');
  5.     $action = 'forminator_resend_notification_email';
  6.  
  7.     $args = array(
  8.         'action' => $action,
  9.         'entry_id' => $entry_id,
  10.     );
  11.  
  12.     $response = wp_remote_post($admin_url, array(
  13.         'method' => 'POST',
  14.         'timeout' => 45,
  15.         'redirection' => 0,
  16.         'blocking' => true,
  17.         'body' => $args,
  18.     ));
  19.  
  20.     if (is_wp_error($response)) {
  21.         $error_message = $response->get_error_message();
  22.         echo "Hiba történt a POST kérés során: " . $error_message;
  23.     } else {
  24.         $response_code = wp_remote_retrieve_response_code($response);
  25.         $response_body = wp_remote_retrieve_body($response);
  26.  
  27.         echo "Request code: " . $response_code;
  28.         echo "Request answer: " . $response_body;
  29.     }
  30. } else {
  31.     // Error during creating Forminator entry.
  32.     echo "Error during creating Forminator entry.";
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment