Last active
May 12, 2020 15:22
-
-
Save stuartf/37f4959c8091f4eaabed2386d130400d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// You'll need to use composer to install "symfony/browser-kit", "symfony/http-client" and "symfony/mime" | |
// Bring in the browserkit library | |
require_once( 'vendor/autoload.php' ); | |
use Symfony\Component\BrowserKit\HttpBrowser; | |
use Symfony\Component\HttpClient\HttpClient; | |
// Make the galaxy form call our upload function when it's completed | |
add_action( 'gform_after_submission', 'post_to_third_party', 10, 2 ); | |
function post_to_third_party( $entry, $form ) { | |
// Create our virtual browser | |
$client = new HttpBrowser(HttpClient::create()); | |
// Load the form from zen planner | |
$crawler = $client->request('GET', 'https://attteamlima.sites.zenplanner.com/prospect.cfm?programId=F5E46971-D514-4935-A231-C3439DA2C9D4&frame=true'); | |
// Send the entries from the galaxy form to the zen form | |
$client->submitForm('Submit Form', [ | |
'FirstName' => rgar( $entry, '1.3' ), | |
'LastName' => rgar( $entry, '1.6' ), | |
'PrimaryEmail' => rgar( $entry, '2' ), | |
'PrimaryPhone' => rgar( $entry, '3' ), | |
'Custom02' => rgar( $entry, '4' ) | |
]); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment