1

请帮助我使用 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--

任何帮助都会是很大的帮助。

4

3 回答 3

1

它的工作原理与 PHP 手册中的解释完全相同:

$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);
于 2012-05-07T09:59:13.303 回答
1

http://php.net/manual/en/function.curl-setopt.php

CURLOPT_POSTFIELDS
于 2012-05-07T09:56:07.550 回答
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);         

注意:数组中必须是所有post数据。

于 2013-11-08T11:59:52.807 回答