Skip to content

Instantly share code, notes, and snippets.

@christopherhill
Last active December 19, 2015 15:49
Show Gist options
  • Save christopherhill/5978974 to your computer and use it in GitHub Desktop.
Save christopherhill/5978974 to your computer and use it in GitHub Desktop.
Marketo Web Proxy
<?php
$staging = "http://marketostaging.domain.com/index.php/leadCapture/save";
$production = "http://marketoproduction.domain.com/index.php/leadCapture/save";
$url = '';
if (isset($_GET["s"])) {
$stagingFlag = $_GET["s"];
if ($stagingFlag == "true") {
$url = $staging;
} else {
$url = $production;
}
} else {
$url = $production;
}
if (isset($_GET["Email"])) {
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($_GET),
),
);
// todo: must try to preserve referer, which is currently correct due to the simultaneous firing of the createLead API call.
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
// var_dump($result);
} else {
header("HTTP/1.0 403 Forbidden");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment