我希望注册表单数据转到 Salesforce 潜在客户表。
我有一个 WordPress 网站,我使用 php 代码制作了一个注册表单,每当用户注册时,表单数据都会转到 Backendless 用户表,为此我使用了 REST API 和 cURL。所以现在我希望相同的数据也转到 Salesforce Lead 表中。我还没有找到任何解决此问题的 REST API 解决方案,我需要 REST API 或 cURL 的代码或可以完成我的工作的插件和将用户数据推送到 Salesforce。
我可以附上一个带有 WordPress 代码的 backendless 以供参考
<?php
if(isset($_POST['Submit']))
{
//extract data from the post
//set POST variabless
$fname = $_POST['fname'];
$email = $_POST['email'];
$password = $_POST['password'];
//retrieve the data from the backendless table and check if the email is present in it.
$service_url1 = 'https://api.backendless.com/{APP-KEY}/{REST-API}/data/Users';
$curl1 = curl_init($service_url1);
curl_setopt($curl1, CURLOPT_RETURNTRANSFER, true);
$curl_response1 = curl_exec($curl1);
if ($curl_response1 === false) {
$info1 = curl_getinfo($curl1);
curl_close($curl1);
die('error occured during curl exec. Additioanl info: ' . var_export($info1));
}
curl_close($curl1);
//getting the array which is stored in $curl_response1, putting it in decoded and puiling out only the email field and arranging it properly.
$decoded = json_decode($curl_response1);
$res1 = array_column($decoded, 'email');
$res2 = implode("', '", $res1);
//checking if the new user email is present in the array or not.
if (in_array($email, $res1))
{
echo"<div style='text-align:center'>You have already registered before.</div>";
}