here is a code snippet that will need some more setup , but it gives you an ez way to post data to eloqua form
basic steps
1) create a form , accepting contact information for example
2) in php (you will need to create the constants for below)
<?php
// define variables, constants needed for below
class someposter
{
private $eloquapostform='SomeFormInEloqua';
private $postarray= array(elqCustomerGUID=>'1212121' , firstName=>'first', lastName='last' ); // fields you want posted to form
public function post_eloqua_form()
{
try {
$url = $eloquapostform; // need to define this
$fields_string="";
//url-ify the data for the POST
foreach($postarray as $key=>$value) {
$fields_string .= $key.'='. urlencode($value) . '&';
}
$fields_string = rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//curl_setopt ($ch, CURLOPT_CAINFO, "config/cacert.pem");
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($ch, CURLOPT_POST, 1);
//curl_setopt ($ch, CURLOPT_HEADER, 0);
//curl_setopt($ch,CURLOPT_POST, count($postarray));
curl_setopt ($ch, CURLOPT_POSTFIELDS, $fields_string);
ob_start();
curl_exec ($ch);
// echo 'after exec: ','<br>';
$retrievedhtml = ob_get_contents();
ob_end_clean();
//echo 'output buffer:::',urlencode( $retrievedhtml) ,':::<br>';
$err=curl_error($ch);
// echo "\n\n cURL error ---+" . $err . "+--error<br>";
if ( strpos($retrievedhtml,'error') > 0 || strpos($retrievedhtml,'unavailable') > 0 )
{
logexceptiondetailed( __METHOD__ , $err . ' output: ' . $retrievedhtml , ' Eloqua URL: ' . $url . $fields_string);
}
//close connection
curl_close($ch);
// for debugging echo '<br>' ,'---',$url,$fields_string,'---',' <br>';
return $url."?".$fields_string;
}
catch (Exception $e) {
logexception( __METHOD__ , $e->getMessage() );
return null;
}
}
}
?>