I need to submit my web form to two different places. I have used the below code to do this successfully to the first. But Sugar doesnt seem to like it. I just get the error message :
"We are sorry, the server is currently unavailable, please try again later."
If anyone can help that would be great. I can't think of any reason why its not working. Using a normal form that submits to WebToLeadCapture.php works fine.
MattPHP Code:$post_array2 = array(
"campaign_id" => "77961414-1638-d7ab-cdf0-45fefbe0131c",
"redirect_url" => "http://google.com",
"assigned_user_id" => "1",
"req_id" => "last_name;",
"last_name" => "farty",
"phone_home" => "2323323323",
"Submit" => "Submit"
);
$post_data2 = http_build_query($post_array2);
$url2 = "http://d36349.u30.m8solutions.com/WebToLeadCapture.php";
$ch2 = curl_init(); // initialize curl handle
curl_setopt($ch2, CURLOPT_URL,$url2); // set url to post to
curl_setopt($ch2, CURLOPT_FAILONERROR, 1);
curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch2, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch2, CURLOPT_TIMEOUT, 3); // times out after 4s
curl_setopt($ch2, CURLOPT_POST, 1); // set POST method
curl_setopt($ch2, CURLOPT_POSTFIELDS, $post_data); // add POST fields
$result = curl_exec($ch2); // run the whole process
curl_close($ch2);
echo $result;


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks