Notice: Use of undefined constant POSTFIELDS - assumed 'POSTFIELDS' in 。。Warning: curl_setopt() expects parameter 2 to be long, string given in 。。错误信息:未将对象引用设置到对象的实例。1 ------------------------------ 我用firebug打开来看源站的情况,post数据显示是 cid 85487 page 1 而不是cid=85487&page=1的形式, 头文件中Content-Type application/x-www-form-urlencoded请问我还需要怎么设置才可能正确取到响应。
curl_setopt($curl,CURLOPT_POSTFIELDS,"cid=84096&page=1");//http post body.
curl_setopt($curl,CURLOPT_POST,TRUE);
curl_setopt($curl,CURLOPT_POSTFIELDS, $data);
我用firebug打开来看源站的情况,post数据显示是
cid 85487
page 1
而不是cid=85487&page=1的形式,
头文件中Content-Type application/x-www-form-urlencoded请问我还需要怎么设置才可能正确取到响应。
全部数据使用HTTP协议中的"POST"操作来发送。要发送文件,在文件名前面加上@前缀并使用完整路径。这个参数可以通过urlencoded后的字符串类似'para1=val1¶2=val2&...'或使用一个以字段名为键值,字段数据为值的数组。如果value是一个数组,Content-Type头将会被设置成multipart/form-data。