CODELABS
Find out some interesting information on stuff we have been dealing with over the past few years.
If it's something that that has interest us in the evolution of web and marketing, we will write about it.
July 21st, 2011
While on assignment with Intel Australia I was given the task to tidy up their product download ordering system. The ordering system included a product rating system. The rating system is a great tool to add to your download reports. Determining the popularity of a document based on downloads and ratings.

The solution that was used was something I had not seen with any other Eloqua clients and showed innovation in the usage of Eloqua and jQuery.
After cleaning up the way it was done I decided to share it with other Eloqua users.
The jQuery plugin that was used in this http://www.fyneworks.com/jquery/star-rating/.
It’s a simple enough plugin, however without a database the results cannot be maintained for new and returning visitors. To enable the average results to display when a user returns to the page the results can be saved to Eloqua and returned using a simple web lookup.
Let’s take a look.
I have created an example version here http://www.codeevolution.com.au/sample/
There are plenty of ways to go about the storing of values and in the example below I decided to use the prospect record.
1). Create the fields necessary to maintain the required data.
I chose to save 3 fields per product/document. I also chose to prefix the 3 fields with the product name. You could chose to save only 2 fields depending on how many prospect fields you have available and how many products/documents you are rating. I liked the idea of 3 as the monthly reports would require no manual calculations.
Count: The total amount of times the rating was clicked
Total: The total of all ratings combined
Average: The average rating (Total/Count)
2). Create a dummy prospect (requires a dummy email address).
We will continue to overide this prospect every time with the new values submitted by the blind form submit.

3). Create a form to capture the rating.
The form is really simple and it only requires one processing step (Update Existing Record or Data Object). The processing step needs to save the ratings for a specific product. Each product does not get rated at the same time so the fields need to only update if there is value passed through the form.

4). Create the web data lookup.
The web lookup will simply use the dummy prospect record to return the fields from the prospect record which contain the data.

The code.
The code sample is reasonably straight forward. You can get an idea how you may retro fit this for your own documents/products. Let’s take a look.
1). The product html.
The html below shows I have included the three hidden fields for the product as well as the 5 hidden fields for ratings.
<div class="product">
<div class="label">Rate Document 1:</div>
<div class="rating"><input id="product1_count" type="hidden" name="product1_count" />
<input id="product1_total" type="hidden" name="product1_total" />
<input id="product1_average" type="hidden" name="product1_average" />
<input class="star" type="radio" name="product1" value="1" />
<input class="star" type="radio" name="product1" value="2" />
<input class="star" type="radio" name="product1" value="3" />
<input class="star" type="radio" name="product1" value="4" />
<input class="star" type="radio" name="product1" value="5" /></div>
</div>
2). The data lookup scripts.
The data lookup scripts are pretty straight forward. When the page loads the lookup is performed usimg the web data lookup key and the email address of the dummy user. The data returned is passed into the hidden fields and the average checkbox/star is checked.
<script type="text/javascript" src="elqNow/elqCfg.js"></script><script type="text/javascript" src="elqNow/elqImg.js"></script>
<script type="text/javascript">
>var elqPPS = '50';
var elqDLKey = escape('d0c4544a541d4e8cb1cd633ed886629a');
var elqDLLookup = '<P_EmailAddress>rating@codeevolution.com.au</P_EmailAddress>';
</script>
<script type="text/javascript" src="elqNow/elqCPers.js"></script><script type="text/javascript">
$(document).ready(function() {
$('body').append('<iframe id="my_iframe"></iframe>');
rating1=Number(GetElqContentPersonalizationValue("P_Product1_Average1"))-1;
$('input[name=product1]:eq('+rating1+')').attr('checked', 'checked');
$("#product1_average").val(GetElqContentPersonalizationValue("P_Product1_Average1"));
$("#product1_count").val(GetElqContentPersonalizationValue("P_Product1_Count1"));
$("#product1_total").val(GetElqContentPersonalizationValue("P_Product1_Total1"));
rating2=Number(GetElqContentPersonalizationValue("P_Product2_Average1"))-1;
$('input[name=product2]:eq('+rating2+')').attr('checked', 'checked');
$("#product2_average").val(GetElqContentPersonalizationValue("P_Product2_Average1"));
$("#product2_count").val(GetElqContentPersonalizationValue("P_Product2_Count1"));
$("#product2_total").val(GetElqContentPersonalizationValue("P_Product2_Total1"));
});
</script>
3). The star rating system.
The star rating system needs to be included with some tweaks to what happens when the user clicks on a star. The rating system cosists of 3 files.
A css file – Left unchanged
A star.js file – Left unchanged
A javscript file – Minor tweaks.
The biggest modification that was required was to the rating javascript file. It required an onClick event to pass the rating to Eloqua via a blind form submit. I decided the simplest way to do this was placing an iframe on the page and changing the iframe src to the Eloqua form.
.click(function(){
var current_name = $(this).attr("name");
var current_rating = $(this).attr("value");
count=Number($("#"+current_name+"_count").val())+1;
$("#"+current_name+"_count").val(count);
total=Number($("#"+current_name+"_total").val())+Number(current_rating);
$("#"+current_name+"_total").val(total);
average=Math.round(total/count);
$("#"+current_name+"_average").val(average);
var post = current_name+"_count="+count+"&"+current_name+"_total="+total+"&"+current_name+"_average="+average;
$('#my_iframe').attr('src','http:
+post);
$(this).rating('fill');
$(this).rating('focus');
return >false;
});
The end result looks great and also provides us with some great reporting stats to go with our download reports

Posted in CSS, Eloqua, JQuery, Marketing | No Comments »
March 23rd, 2011
I am in the final throws of development of an Eloqua Cloud Connector for MessageMedia. While digging around for documentation on this, I found absolutely zero information on how to get this done in PHP. I found that to be strange as a large percentage of Eloqua clients I have worked with predominantly build there applications in PHP.
Not letting this stop me I plugged away at it and finally I have some information and code samples to share.
As the Cloud Connector requires use of the Eloqua API, I needed to write a client in PHP that could communicate with their various WSDL files. It didn’t take long before I found NuSoap. With a few simple commands NuSoap allowed me to connect and start manipulating data.
One thing I needed to do frist was to check the NuSoap libraries to make sure that the encoding would not cause any of the calls to fall over. I found that NuSoap added some extra bits of encoding which caused the calls to contuously return “BAD CALL”. So in the nusoap.php file I removed these elements and things started to work correctly. The below peice of code is what I now have from line 707 – 712 in nusoap.php
$headers = "<SOAP-ENV:Header xmlns:wsse=\"http:}
>return
'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
'<SOAP-ENV:Envelope'.$ns_string." xmlns:arr=\"http:
I have included the entire NuSoap lib so you can download it here.
To get started you will need to have a few little pieces of information.
- Location of Eloqua CloudConnector wsdl file
- Location of Eloqua data manipulation wsdl file
- Eloqua account name
- Eloqua username
- Eloqua password
- Eloqua program step id
For security reasons in the example code below I have changed the above elements.
Without spending hours analysing each strip of code. I will identify key elements in an evolving class. The code essentially grabs contacts from your specified program step, queries the contact record for key peices of information on that contact record, then passes the contacts into to function to run actions on them. After the actions are performed the contacts in program step are marked as being “complete”.
The code below establishes two connections to Eloqua via two separate wsdl files. One to perform eloqua program step actions (Cloud Connector wsdl), the other to perform key contact/entity actions.
$cloudConnector = new CloudConnector($EloquaAccount, $EloquaPassword);
The code below grabs contacts from your Eloqua program step which have a status “AwaitingAction”.
$programMembers = $cloudConnector->listMembersInStepByStatus($EloquaStep);
The code below retrieves key contact information from all the contacts returned from the program step.
$membersInfo = $cloudConnector->retrieve($programMembers, $EloquaStep);
The code below runs your specific actions on the contacts.
$cloudConnector->performActionOnContacts($membersInfo);
The code below sets the contacts in the program step to complete allowing them to move to the next step in the program.
$cloudConnector->setMemberStatus();
The code below is the whole sample of class and functions used in my Cloud Connector. I will update this over the next couple weeks as I polish this code to get it working smoothly.
<?php
require_once('lib/nusoap.php');
$EloquaCompany='YourEloquaAccountName';
$EloquaUsername='Eloqua.Username';
$EloquaAccount=$EloquaCompany.'\\'.$EloquaUsername;
$EloquaPassword='Password';
$EloquaStep=123;
$cloudConnector = new CloudConnector($EloquaAccount, $EloquaPassword);
$programMembers = $cloudConnector->listMembersInStepByStatus($EloquaStep);
if(sizeof($programMembers)>0){
$membersInfo = $cloudConnector->retrieve($programMembers, $EloquaStep);
$cloudConnector->performActionOnContacts($membersInfo);
$cloudConnector->setMemberStatus();
}
class CloudConnector{
protected $cloudClient;
protected $eloquaClient;
protected $headers;
protected $stepMembers;
public function __construct($Eloqua_username, $Eloqua_password){
$this->headers=array('wsse:Security'=>array('wsse:UsernameToken'=>array('wsse:Username'=>$Eloqua_username,'wsse:Password'=>$Eloqua_password)));
$this->cloudClient = new nusoap_client("https:, 'wsdl');
$cloudErr = $this->cloudClient->getError();
if($cloudErr){
$this->error('CloudConnector Constructor error', $cloudErr, $this->cloudClient->request, $this->cloudClient->response, $this->cloudClient->getDebug());
}
$this->cloudClient->setUseCurl(true);
$this->cloudClient->soap_defencoding = 'UTF-8';
$this->eloquaClient = new nusoap_client("https:, 'wsdl');
$eloquaErr = $this->eloquaClient->getError();
if($eloquaErr){
$this->error('EloquaConnector Constructor error', $eloquaErr, $this->eloquaClient->request, $this->eloquaClient->response, $this->eloquaClient->getDebug());
}
$this->eloquaClient->setUseCurl(true);
$this->eloquaClient->soap_defencoding = 'UTF-8';
}
public function error($type, $err='', $request='', $response='', $debug=''){
echo '<h2>'.$type.'</h2>';
if($err!='')
echo '<pre>' . $err . '</pre>';
if(is_array($debug)){
echo '<h2>Result</h2><pre>'; print_r($debug); echo '</pre>';
}
else{
if($request!='')
echo '<h2>Request</h2><pre>' . htmlspecialchars($request, ENT_QUOTES) . '</pre>';
if($response!='')
echo '<h2>Response</h2><pre>' . htmlspecialchars($response, ENT_QUOTES) . '</pre>';
if($debug!='')
echo '<h2>Debug</h2><pre>' . htmlspecialchars($debug, ENT_QUOTES) . '</pre>';
}
}
public function performActionOnContacts($contacts){
foreach ($contacts['DynamicEntity'] as $contact) {
$contactData=array();
foreach($contact['FieldValueCollection']['EntityFields'] as $field){
$contactData[$contact['Id']][$field['InternalName']]=$field['Value'];
}
foreach($contactData as $key=>$contactFields){
MessageMedia::sendSMS($contactFields['C_EmailAddress'], $contactFields['C_MobilePhone'], $contactFields['C_Country']);
}
}
}
public function listMembersInStepByStatus($stepId){
$params = array('stepId'=>$stepId,'status'=>'AwaitingAction','pageNumber'=>1,'pageSize'=>10);
$result = $this->cloudClient->call('ListMembersInStepByStatus', $params,'','',$this->headers);
if ($this->cloudClient->fault) {
$this->error('Fault (Expect - The request contains an invalid SOAP body)','', $this->cloudClient->request, $this->cloudClient->response, $this->cloudClient->getDebug());
return >false;
}
else{
$err = $this->cloudClient->getError();
if ($err) {
$this->error('Error',$err, $this->cloudClient->request, $this->cloudClient->response, $this->cloudClient->getDebug());
return >false;
}
}
return $result['ListMembersInStepByStatusResult'];
}
public function retrieve($members, $stepId){
$actionMembers=array();
$stepMembers=array();
foreach($members['Member'] as $member){
if($member['EntityId']!=''){
$actionMembers[]=$member['EntityId'];
$this->stepMembers['Member'][]=array('EntityId'=>$member['EntityId'],'StepId'=>$stepId,'EntityType'=>$member['EntityType'],'Id'=>$member['Id'],'Status'=>$member['Status']);
}
}
if(!empty($actionMembers)){
$params = array('entityType'=>array('ID'=>'0','Name'=>'Contact','Type'=>'Base'),'ids'=>array('int'=>$actionMembers),'fieldNames'=>array('string'=>array('C_EmailAddress','C_MobilePhone','C_Country')));
$contacts = $this->eloquaClient->call('Retrieve', $params,'','',$this->headers);
if ($this->eloquaClient->fault) {
$this->error('Fault (Expect - The request contains an invalid SOAP body)', '', $this->eloquaClient->request, $this->eloquaClient->response, $this->eloquaClient->getDebug());
return >false;
}
else{
$err = $this->cloudClient->getError();
if ($err) {
$this->error('Error',$err, $this->eloquaClient->request, $this->eloquaClient->response, $this->eloquaClient->getDebug());
return >false;
}
}
return $contacts['RetrieveResult'];
}
else
return >false;
}
public function setMemberStatus(){
$params = array('members'=>$this->stepMembers,'status'=>'Complete');
$contacts = $this->cloudClient->call('SetMemberStatus', $params,'','',$this->headers);
if ($this->cloudClient->fault) {
$this->error('Fault (Expect - The request contains an invalid SOAP body)', '', $this->cloudClient->request, $this->cloudClient->response, $this->cloudClient->getDebug());
}
else{
$err = $this->cloudClient->getError();
if ($err) {
$this->error('Error',$err, $this->cloudClient->request, $this->cloudClient->response, $this->cloudClient->getDebug());
return >false;
}
}
}
}
?>
Posted in Eloqua, PHP | No Comments »
January 5th, 2011
In my pursuit for knowledge I decided this month I would tackle the new web markup HTML5. From all that I can gather HTML5 is the World Wide Web Consortium’s attempt to standardise web semantics (the way page elements are linked and structured in order to give a page meaning). In the web form this is beneficial on many levels. I believe the main benefits are:
- SEO (search engine optimisation).
- Accessibility (making websites usable by people of all abilities and disabilities)
- Semantics (a clear and defined structure for HTML)
For the most part with W3C’s XHTML this can achieved already. But for the every day developer XHTML can be a little difficult to understand as with a complex page it might be difficult to determine where each element starts and stops.
With the introduction of specific tags HTML5 tries to alleviate the confusion. Here are the new tags and their meaning.
- section: A part or chapter in a book, a section in a chapter, or essentially anything that has its own heading in HTML 4
- header: The page header shown on the page; not the same as the head element
- footer: The page footer where the fine print goes; the signature in an e-mail message
- nav: A collection of links to other pages
- article: An independent entry in a blog, magazine, compendium, and so forth
Introducing these new tags means we need to add some javascript to make sure your site is backwards compatible (the page still looks as it should in older browsers).
Viewing an example page layout you can clearly see that a page is reasonably easy to understand.
<!DOCTYPE html>
<html lang="en">
<head class="html5reset-bare-bones">
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
</head>
<body>
<div>
<header>
<h1></h1>
<nav>
<ul>
<li><a href=""></a></li>
</ul>
</nav>
</header>
<article></article>
<footer></footer>
</div>
</body>
</html>
For simple page layouts HTML5 is easy to implement and define. For complex pages HTML5 is still a little ambiguous.
The biggest issue is defining the standard page hierarchy between these new tags (nesting tags). From all the research over the past few days, developers structure these elements differently. I was able to validate the site you are on quite easily using HTML5 but my understanding and the understanding of others seems to differ from blog to blog.
Looking at the different tags there is no definition of what can be nested inside what. Some might determine everything can be nested inside everything. I think some make sense and some don’t.
Lets take the section tag. I think it seems logical that an article can belong in a section. I think its logical from articles and sections to belong inside aside tags. But from all the documentation that is around this is not clearly defined. And from all the examples around there seems to be varying opinions on this.
<aside>
<section>
<article></article>
</section>
</aside>
So for now I think there is a little bit more that needs to be done with HTML5 before it becomes accepted and developed with similarity across all websites. In saying this the basis of HTML5 is a step forward for a structured language and I will continue to use it going forward.
Posted in CSS, HTML | No Comments »
December 2nd, 2010
There are very few integrations running between NetSuite OneWorld and Eloqua. Actually I think I might have completed the first one. This being the case while performing an integration for MessageMedia, I came across an issue with the Eloqua WSDL file. Essentially it does not include a field (Subsidiary) that is required for contacts to be created in NetSuite. This meant we had a major issue with getting new contacts using the standard API integration rules.
This being the case, there was always going to be many ways around this problem using Eloqua. One that I came up with (which ended up proving to be usefull for another project) was to use NetSuite’s form capture component. By posting data using Eloqua’s form processing steps, I could get the basic contact information into a NetSuite instantly. Having the contact exist in both systems was the first step, we still needed to be able to maintain changes in contact data going forward. As the contact was newly created in NetSuite it would be synched into Eloqua on the next 2 hour data pull. The synch from NetSuite includes the contactid which would allow normal updates to continue going forward. Adding the new contact into my Eloqua->NetSuite integration program and adding a 2 hour wait step at the start, allowed enough time for the contactid to be added to the Eloqua contact record. All of the extra information we captured within Eloqua could now be passed across as normal.
This can also be useful when you want real time creation of leads in your CRM. Sometimes waiting for the 2 hour window is too long for sales to make the connection. Using this scenario will solve that, so long as your CRM handles capture of post data.
Posted in Eloqua, Marketing | No Comments »
October 30th, 2010
Recently while on assignment with MessageMedia (www.message-media.com), I took on the task to integrate their free trial system with Eloqua.
MessageMedia provide B2C and B2B 2 way SMS messaging services throughout the globe.
One of their biggest problems was the abundance of people attempting to use their system for personal use. Allowing people to free trial with just the bare essentials (username & email address) was adding huge overheads to the costs per lead.
Integrating the system with Eloqua meant I had immediate visibility into the validity of the email address entered into the free trial form. Doing this alone would have been enough to satisfy the process and allow the user to proceed with the trial. Thinking outside the box I decided to take this one step further. We would validate the users contact mobile/cell phone number as well. Seeing as the sales ability to contact the leads via phone was the main importance of the business, validating the mobile number was the perfect solution. Sending the message also acted as a great marketing experience. As this is basically what most users were expecting to use the system for.
MessageMedia uses a complex system that provides delivery reports for each message sent. Similar to Eloqua’s email delivery reports. Combining both of these together created a highly successful system. The sales team can utilise their time better by acting on those leads with valid mobile/cell and valid email address.
I definitely could see this working for many companies. Not just those in the sms/telecommunications industry.
Tags: Marketing, Marketing Automation, Marketing Qualification, Online Marketing, SMS Marketing
Posted in Marketing | 5 Comments »
August 14th, 2010
Almost every company that we have been engaged to implement marketing processes for, make the mistake in trying to implement dramatic changes to business processes too quickly. Margins have usually been set by key stakeholders and come hell or high water those targets will be met.
Making significant business process changes quickly and without an agile acceptance process, is a recipe for disaster. Even if changes turn out to be working for the marketing department, people won’t like dramatic change to the way they do things. This can curb confidence in the marketing departments role.
Although most online marketers will use best practices for your industry, not every model works for every organisation. There are so many variables in play that usually mean that model needs some tweaking. Using small implementations can allow you to learn where those tweaks need to be made. Using this rule marketers can still enjoy small wins. Small wins enable you to gain company wide acceptance and allow stakeholders to adapt to the changes easier. Implenting slowly also means the changes to the best practice models you are following are subtle. This allows the changes made will be rolled out quicker in the long run.
Using this as a rule of thumb we are finding a level of success we never have had before.
Tags: Marketing, Marketing Automation, Online Marketing
Posted in Marketing | No Comments »
July 25th, 2010
2010 is going fast but already it has been a massive year for Code Evolution.
While all news reports make us believe we are in the middle of a financial crisis, work streams through the doors which is somewhat to the contrary.
Moving the office from London to Melbourne might have seemed like a reason to drop the tools and spend more time relaxing and taking in the mild weather. Yet instead business is expanding, more and more exciting projects are under way.
Amongst all of the madness we decided that a new website was in order.
So many agencies get caught up in the dilemma of work overload that they neglect the one thing that represents them the best. So here it is.
If your looking for an agency that who has been there and done that. We can offer solutions for a fraction of the cost of the big players, so get in touch today.
Tags: Development, Marketing, News
Posted in Marketing | No Comments »
January 7th, 2010
Well for certain it has been a while since my last post. Picking up my life in London and planting it back in the home land has meant I have neglected to put anything worth looking at on my site for a while.
In any case here I am again, hoping to help a few people out with some experiences I have had lately.
I’m currently building a series of car & truck rental websites for Carlingford Fleet. The sites I am developing use a booking engine called Cars+, which is the same engine that most car rental companies use in Australia. The system has been developed by a company called Pearsons and to be honest the system is prehistoric. I would imagine for such a highly used system that they would provide an API, but hey, if it’s not broken then don’t fix it.
In any case I developed a few small work arounds that might help the next developer that tackles the beast. The system which manages bookings for Cars + has a front end component called WebRes. Basically this is a html shell created by Pearsons to allow companies such as Carlingford to embed their solution into their websites. Their solution is to use an iframe to load the WebRes solution into your own site. The biggest draw back of this is the html in the WebRes platform is appalling. It has large chunks of inline style and has no client side error control. I also feel that using an iframe really restricts the control you have over the look and feel.
So I decided to take the WebRes solution and mould it into a solution I could work with. Basically instead of using an iframe I decided to return the data to a string using php. Using my quotation form, I make a request to my own php page (quote.php) which then uses standard post techniques to query the WebRes page for available cars. Once I have the data in a string, I then used a series of php string replace functions to strip back the data. Once I have the raw data I could then apply my own error handling functionality and style.
switch ($_POST['action']) {
case "quote":
$quote=get_quote($_POST);
break;
}
function get_quote($data){
$quote=https_post('https:,$data);
$quote=remove_style($quote);
return remove_footer($quote);
}
My $quote variable now contains data that I am happy with so I can just print that in the html file so it displays in a way that I am happy with (see below).
<body>
<?php print $quote;?>
</body>
And that’s it. Using this method I can basically do what I want. A little extra work but a much better solution that the iframe approach.
Posted in PHP | No Comments »
June 23rd, 2009
Just this week we had a client complaining about the number of AdWord conversions that were occuring on their site from “bounced traffic” (people who arrive on the site but leave immediately). In normal circumstances (html sites) we could place the AdWord scripts on pages that are deeper than the home page and that would solve the issue.
This case was quite unique however, as the website is purely flash (http://www.myknowledgeiq.com/). So we had to come up with a way of loading the AdWord scripts after a certain section of the flash app had been completed. In this case after form submission.
The simple solution was to call a javascript function from the flash file. The javascript function then would load our analytics scripts behind the scenes.
Firstly I created html file which contained all the AdWords scripts. The file is called analytics.html (see below).
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"></script>
The javascript function would then load the html file into an iframe.
function google_track(){
$('body').append('<iframe id="google"></iframe>');
$('#google').attr('src', 'https://www.mydomain.com/analytics.html');
}
And thats it. We are converting ads in the middle of the application and we are no longer paying for bounces. I’m never keen on creating iframe solutions, as they aren’t accessible. In this case the application was entirely written in flash and it want a requirement to make an alternate accessible version.
&
Posted in Analytics, Flash, JQuery | 2 Comments »
June 10th, 2009
Recently we developed a new site for Banner called adapt.b1.com. Francisco did a great job of creating the navigation with jQuery.scrollTo plug in.
The website has two forms which needed to be submitted without refreshing the page. This was important as a page refresh would stuff the whole navigation component. So we started off using standard jQuery post techniques. This is where we realised we had a bit of a problem. As the website had to be hosted within Eloqua, standard post techniques (see jQuery example below) would not work. Basically from what I can tell $.post will not allow you to submit data to a remote server.
$(document).ready(function() {
$("form").submit(function() {
var post = $("form").serialize();
$.post("http://now.eloqua.com/e/f2.aspx", post);
return false;
});
});
Now in normal circumstances our alternate solution would be to post the data to a local PHP file. This would allow us to use php methods to post the data to the remote server see below.
$(document).ready(function() {
$("form").submit(function() {
var post = $("form").serialize();
$.post("local_file.php", post);
return false;
});
});
local_file.php
<?php
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1) ;
curl_setopt($ch, CURLOPT_POSTFIELDS, $str_request);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result = curl_exec($ch);
curl_close($ch);
return $result;
?>
This solution was also not possible as we were hosting the website within Eloqua, which doesn’t allow us to host local server side scripting pages.
Our solution although at first didnt seem very pretty was quite effective and was perfect for this scenario.
We decided that if we could use an iframe on the page. We could submit data to the remote server by changing the iframe source.
As we develop all our pages to XHTML strict standard, we were reluctant to create an iframe solution. Due to the restrictions with hosting the site within Eloqua however, there really wasn’t any other choice. Using jQuery we were able to cheat a little bit by adding the iframe to the page onLoad. This meant the page would be accessible and allow us to validate it to W3C standards. Once the iframe is loaded we could use jquery to listen for form submission. Once the form is submitted we can capture all the form data and submit it to the iframe. And that worked a charm. See the jQuery code below.
jQuery(function( $ ){
//add iframe to the page
$('body').append('<iframe id="my_iframe"></iframe>');
$('#submit-button').click(function() {
//capture all the form data
var post = $('#my_form').serialize();
//submit the data to the iframe src
$('#my_iframe').attr('src', 'http://now.eloqua.com/e/f2.aspx?'+post);
// return false otherwise the page will reload
return false;
});
});
Posted in JQuery | No Comments »