0
foreach ($iContactData as $akey => $aval) {
$post_items[] = $akey . '=' . $aval;
}
$post_string = implode ('&', $post_items);
$url='https://app.icontact.com/icp/signup.php';
$response = wp_remote_post($url, array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(),
'body' => array($post_string),
'cookies' => array()
)
);
if(is_wp_error($response)) {
echo 'Something went wrong!';
} else {
echo 'Response:<pre>';
print_r($response);
echo '</pre>';
}
当我运行测试时,它打印错误。似乎我可能是错误的数组身体将数据发布到远程?当发布数据时,wp_remote_post没有给出预期的行为
将不胜感激。谢谢
通过 '它印错误' 你的意思是输出 “出事了!”? (即调用'wp_remote_post'失败。)试试这个:'echo'出错了! '。 $ response-> get_error_message();',然后让我们知道... – Vino 2012-08-24 06:22:42
也在一个可能的类似问题[#11096611](http://stackoverflow.com/questions/11096611/wordpress-wp-remote-post) – Vino 2012-08-24 06:29:01