Php 为什么可以';我不能发布到我的卷曲脚本吗?

Php 为什么可以';我不能发布到我的卷曲脚本吗?,php,curl,infusionsoft,Php,Curl,Infusionsoft,我需要将数据从一个表单发送到两个单独的位置。我以前用一个简单的cURL脚本做过这件事,但现在在我的测试中,我无法让它将任何东西发布到我的第二个源代码中。我正在用PAW发送邮件,提供正确的信息。下面是我的cURL脚本。我看这个太久了 $url = 'https://vf267.infusionsoft.com/app/form/process/41f58953f72a770df094c4525be6fb6b'; $fields = array( 'inf_form_xid' => urle

我需要将数据从一个表单发送到两个单独的位置。我以前用一个简单的cURL脚本做过这件事,但现在在我的测试中,我无法让它将任何东西发布到我的第二个源代码中。我正在用PAW发送邮件,提供正确的信息。下面是我的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

也许是“返回”这个词

你(修改过的)剧本适合我

<?php

$url = 'https://vf267.infusionsoft.com/app/form/process/41f58953f72a770df094c4525be6fb6b';

$fields = [
    inf_form_xid => '41f58953f72a770df094c4525be6fb6b',
    inf_form_name => 'tester',
    infusionsoft_version => '1.50.0.37',
    inf_field_Email => 'tester@tester.com'
];


//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);

var_export($result);
die('Finished');

return $result;
//close connection
curl_close($ch);

我得到了
“谢谢朋友!我们会很快与您联系。”
稍作修改-应该是什么?这绝对正确。我使用此脚本的服务器似乎设置不正确。。跛脚,免费托管。是的!我想这只是服务器问题;把它放在我的本地机器上,本地主机工作得很好
<?php

$url = 'https://vf267.infusionsoft.com/app/form/process/41f58953f72a770df094c4525be6fb6b';

$fields = [
    inf_form_xid => '41f58953f72a770df094c4525be6fb6b',
    inf_form_name => 'tester',
    infusionsoft_version => '1.50.0.37',
    inf_field_Email => 'tester@tester.com'
];


//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);

var_export($result);
die('Finished');

return $result;
//close connection
curl_close($ch);
<link rel="shortcut icon" href="/slices/style/favicon.ico" type="image/x-icon"/>

<!-- Headers to prevent the caching of pages -->
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-store"/>


<script type="text/javascript" src="/js/lightbox_js.jsp?b=1.50.0.37"></script>
<link rel="stylesheet" href="/css/lightbox_css.jsp?b=1.50.0.37" type="text/css" media="screen"/>
<script type="text/javascript">(function() {
        var styleArray = [];
...
...