form表单curl提交

Content-Type:application/x-www-form-urlencoded 支持的数据类型不是key=>valuea支持rray('field1=value&field2=value2')

/**
* @curl 请求
* @param $url
* @param string $post
* @param string $cookie
* @param int $returnCookie
* @return mixed|string
*/
public function curl_post($url, $post = '', $cookie = '', $returnCookie = 0)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

if ($post != '' && !empty($post)) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('application/x-www-form-urlencoded', 'Content-Length: ' . strlen($post)));
}
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}

很生气...还一种

调用 $result = createForm($this->URL, $data);

function createForm($url, $data)
{
$str = '<!doctype html>
<html>
<head>
<meta charset="utf8">
<title>正在跳转付款页</title>
</head>
<body onLoad="document.pay.submit()">
<form method="post" action="' . $url . '" name="pay">';

foreach($data as $k => $vo){
$str .= '<input type="hidden" name="' . $k . '" value="' . $vo . '">';
}

$str .= '</form>
<body>
</html>';
return $str;
}