我正在使用我在网上找到的捕获系统来保护我的表单。我过去曾多次使用它,但一直使用mailto
函数,这次我需要使用一个动作url,不知道语法
这是验证码脚本
<?php
session_start();
if( isset($_POST['submit'])) {
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST"
echo 'Thank you. Your info has been submitted.';
unset($_SESSION['security_code']);
} else {
// Insert your code for showing an error message here
echo 'Sorry, you have provided an invalid security code';
}
} else {
?>
它需要提交到
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST"><input type="hidden" name="oid" value="XXXXXXXXXXXXXXXX" />
这是为了提交给我的salesforce。
我认为您应该使用SalesForce API而不是直接POST。你可以在这里看到他们的文档:http://www.salesforce.com/us/developer/docs/api/index.htm
您应该使用SOAP客户端向SalesForce发出请求,但是他们已经构建了您可以使用的API,所以请使用它。
您可以使用curl, fsockopen或file_get_contents在PHP中发出post请求。推荐使用cURL。这里有很多例子:
https://stackoverflow.com/a/28411/286619不要忘记启用curl扩展…