Skip to content

Instantly share code, notes, and snippets.

@stuartf
Last active May 12, 2020 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartf/37f4959c8091f4eaabed2386d130400d to your computer and use it in GitHub Desktop.
Save stuartf/37f4959c8091f4eaabed2386d130400d to your computer and use it in GitHub Desktop.
<?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