• pcotro
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi I'm having problems implementing SFGA on a web to lead form. Due to the requirements of the site I am developing, I can't use the standard ACTION for the form; the data must be captured in a database, sent via email and then a function is used to send it to Salesforce.com. The function's code (programmed in PHP) is as follows:

function sendToHost($host,$method,$path,$data,$useragent=0) {
    if (empty($method)) {
        $method = 'GET';
    }
    $method = strtoupper($method);
    $fp = fsockopen($host, 80);
    if ($method == 'GET') {
        $path .= '?' . $data;
    }
    fputs($fp, "$method $path HTTP/1.1\r\n");
    fputs($fp, "Host: $host\r\n");
    if ($method == 'POST') {
        fputs($fp,"Content-type: application/x-www-form-urlencoded\r\n");
        fputs($fp, "Content-length: " . strlen($data) . "\r\n");
    }
    if ($useragent) {
        fputs($fp, "User-Agent: MSIE\r\n");
    }
    fputs($fp, "Connection: close\r\n\r\n");
    if ($method == 'POST') {
        fputs($fp, $data);
    }
    $buf = "";
    while (!feof($fp)) {
        $buf .= fgets($fp,128);
        $buf .= ".";
    }
    fclose($fp);
    return $buf;
}

And is invoked with:

 $sfdata = "oid=XXXXXXXXXXXXXXX" .
     "&salutation="      . urlencode($HTTP_POST_VARS['x_salut'])            .
     "&first_name="      . urlencode($HTTP_POST_VARS['x_fname'])            .
     ... all the form fields go here ... );
    
     $out = sendToHost("www.salesforce.com", "POST",        "/servlet/servlet.WebToLead?encoding=UTF-8", $sfdata);

The problem that I'm having is that I don't know how to do to add the google adwords processing to this form.  The leads are being generated correctly.

Can anyone help me?

Thanks in advance
Patricio

Message Edited by pcotro on 11-08-2007 12:43 PM

  • November 08, 2007
  • Like
  • 0