function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Paul_83ukPaul_83uk 

cURL working on one server not on another.

I have been preparing to move all my forms input across to SF. I have built them all on my test server and they work fine using cURL to POST data to SF. I moved my first form yesterday and it doesn't work. it doesn't throw up any errors just sits on the page running the cURL?

 Any ideas why this would work on one server and not another?

Code below just in case it my code and not a server setting!

Code:
<—php

// SF Org Id.
$oid = "##############";

// Set Return URL if it hasn't been set.
$retURL ="############";

//Set debugging
//$debug = "1";
//$debugEmail = "###########";


// Make sure cURL is enabled
if (!function_exists('curl_init')) {
 error("Curl is not setup on this PHP server and is required for this script");
}


// Process the data that came in from the W2L form

if (isset($_POST)) {
 
 if (count($_POST) == 0) exit("Error.  No data was passed to this script.");
 
 $cleanPOST = array(); // new variable that will hold cleaned up a version of $_POST data
 
 // Loop through the $_POST data and process it
 foreach ($_POST as $key=>$value){
   $cleanPOST[stripslashes($key)] = makeclean($value);
 }

 // Add the Org ID & reyURL if it's not passed into the script from the W2L form
 if (!isset($_POST["oid"])) $cleanPOST["oid"] = $oid;
 if (!isset($_POST["retURL"])) $cleanPOST["retURL"] = $retURL;
 
 //if (!isset($_POST["debug"])) $cleanPOST["debug"] = $debug;
 //if (!isset($_POST["debugEmail"])) $cleanPOST["debugEmail"] = $debugEmail;
 
} else {
 exit("Error.  No data was passed to this script.");
}


// Use cURL to post to Salesforce web to lead 

 // Create a new cURL resource
 $ch = curl_init(); 

 // Set Options
  
  // Point to the Salesforce Web to Lead page
  curl_setopt($ch, CURLOPT_URL, "https://www.salesforce.com/servlet/servlet.WebToLead–encoding=UTF-8");
  
  // 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
 
˜>



ClaiborneClaiborne
Have you verified that the version of PHP is the same on both web servers?