我不确定使用cURL时要使用的编码:
GET:
POST:
(POSTFIELDS =)test = test 1
(POSTFIELDS =)test = test + 1
(POSTFIELDS =)test = test%201
答案 0 :(得分:4)
CURL可以接受post的参数数组,它会为你处理编码:
$array = (
'test' => 'test 1',
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $array);
但是,根据curl文档(http://php.net/curl_setopt,搜索CURLOPT_POST_FIELDS),对于PHP,这些对应该是urlencode()
格式:
$post_args = urlencode('test=test 1');
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_args);