Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Perl, PHP, Python & Ruby Development
- :
- Issue with php web form to salesforce.com insert
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Issue with php web form to salesforce .com insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-14-2012 12:38 PM
I am using the php code here
http://www.paulwest.co.uk/article.php/salesforce-f
to be able to take the data submitted on a contact form and insert it into my clients salesforce acct.
My issue is the website url field is not being inserted into sales force and and I am thinking maybe I need to do something like urlencode() the website url $var but thats not working?
advice? Thanks
My code
[code]
//set POST variables
$url = 'https://www.salesforce.com/servlet/servlet.WebToLe
$cleanPOST = array();
$cleanPOST['first_name']= "$fname";
$cleanPOST['last_name']= "$lname";
$cleanPOST['phone']="$phone";
$cleanPOST['email']="$visitor_email";
$cleanPOST['street']="$address";
$cleanPOST['city']="$city";
$cleanPOST['state']="$state";
$cleanPOST['zip']="$zip";
$cleanPOST['company']="$business";
$cleanPOST['phone']="$phone";
$cleanPOST['lead_source']="Web";
$cleanPOST['description']="$message";
$cleanPOST['title']="$title";
$cleanPOST['website']= urlencode("$website");
$cleanPOST['mobile']="$mobilephone";
// Loop through the $_POST data and process it
foreach ($_POST as $key=>$value){
$cleanPOST[stripslashes($key)] = stripslashes($value);
}
// Add the Org ID
$cleanPOST["oid"] = '##########';
//open connection
$ch = curl_init($url);
// Point to the Salesforce Web to Lead page
curl_setopt($ch, CURLOPT_URL, "http://www.salesforce.com/servlet/servlet.WebToLea
// Set the method to POST
curl_setopt($ch, CURLOPT_POST, 1);
// Pass POST data
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
curl_exec($ch); // Post to Salesforce
curl_close($ch); // close cURL resource
[/code]

