请帮我用PHP cURL
发布以下多部分表单数据url = "http://smssheep.com/sendsms.php";
reffer="http://smssheep.com/";
POSTDATA =-----------------------------187161971819895
Content-Disposition: form-data; name="country"
0091
-----------------------------187161971819895
Content-Disposition: form-data; name="no"
00918714349616
-----------------------------187161971819895
Content-Disposition: form-data; name="msg"
hggggggggggggggggggggggggggggggggggggggggg
-----------------------------187161971819895
Content-Disposition: form-data; name="x_form_secret"
bqu9hv488bxu
-----------------------------187161971819895
Content-Disposition: form-data; name="saveForm"
SEND
-----------------------------187161971819895
Content-Disposition: form-data; name="comment"
-----------------------------187161971819895
Content-Disposition: form-data; name="idstamp"
Ds11xxs27YzNm/r/vf I rmQbz2TS1yaMNXeuHD6ozI=
-----------------------------187161971819895--
任何帮助都将是一个很大的帮助。
答案 0 :(得分:1)
http://php.net/manual/en/function.curl-setopt.php
CURLOPT_POSTFIELDS
答案 1 :(得分:1)
它与explained in the PHP manual完全相同:
$data = 'url = "http://smssheep.com/sendsms.php";
reffer="http://smssheep.com/";
POSTDATA =-----------------------------187161971819895
Content-Disposition: form-data; name="country"
...
Ds11xxs27YzNm/r/vf I rmQbz2TS1yaMNXeuHD6ozI=
-----------------------------187161971819895--'
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
答案 2 :(得分:1)
$url = "http://smssheep.com/sendsms.php";
$reffer="http://smssheep.com/";
$data = array(
'country' => '0091',
'no' => '00918714349616',
'msg' => 'hggggggggggggggggggggggggggggggggggggggggg'
);
$data2 = http_build_query($data);
curl_setopt ($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data2);
curl_setopt ($ch, CURLOPT_REFERER, $reffer);
注意:在数组中必须是所有发布数据。