我需要将数据从一种形式发送到两个不同的位置。我以前用一个简单的 cURL 脚本完成了这项工作,但现在在我的测试中,我无法让它真正将任何内容发布到我的辅助资源中。我正在使用 PAW 通过 POST 发送正确的信息。下面是我的 cURL 脚本。我已经看这个太久了。
$url = 'https://vf267.infusionsoft.com/app/form/process/41f58953f72a770df094c4525be6fb6b';
$fields = array(
'inf_form_xid' => urlencode($_POST['inf_form_xid']),
'inf_form_name' => urlencode($_POST['inf_form_name']),
'infusionsoft_version' => urlencode($_POST['infusionsoft_version']),
'inf_field_Email' => urlencode($_POST['institution'])
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//execute post
$result = curl_exec($ch);
return $result;
//close connection
curl_close($ch);
我将这些值/键对传递给它......这与我发布到的 Infusionsoft 表单相关
inf_form_xid=41f58953f72a770df094c4525be6fb6b
inf_form_name=tester
infusionsoft_version=1.50.0.37
inf_field_Email=tester@tester.com