Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. add_action('gform_after_submission_1', 'add_to_google_spreadsheet', 10, 2);
  2. function add_to_google_spreadsheet($entry, $form) {
  3. // This is the web app URL of your Google Script create in previous step
  4. $post_url = 'https://script.google.com/macros/s/AKfycbwFTe3H0w8bp_2yviORAGhNZzIwvmKmdaCHf KEOdORwjO6pJPQ/exec';
  5. // Put all the form fields (names and values) in this array
  6. $doctor=('doctor source => rgar($entry,3)');
  7. $doctorimage= explode(",",$doctor);
  8. $body = array('first name' => rgar($entry, '1'), 'last name' => rgar($entry, '2'),'doctor source' => rgar($entry, '3'),'doctor image1' => rgar($doctorimage[0], '4'),'doctor image2' => rgar($doctorimage[1], '5'),);
  9. // Send the data to Google Spreadsheet via HTTP POST request
  10. $request = new WP_Http();
  11. $response = $request->request($post_url, array('method' => 'POST', 'sslverify' => false, 'body' => $body));
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement