2012-05-07 153 views
0

請幫我使用PHP捲曲如何使用PHP捲曲

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-- 

任何幫助將是一個很大的幫助,發佈以下多表單數據後置HTML多形式的數據。

+0

雖然它必須是多部分嗎? multipart或application/x-www-form-urlencoded應該以​​相同的方式工作。 –

+0

請看看[這裏](http://scraperblog.blogspot.com/2013/07/php-curl-multipart-form-posting.html) – pguardiario

回答

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); 
+0

這個例子是不完整/錯誤的,因爲你必須傳入一個哈希數組以CURLOPT_POSTFIELDS爲它成爲一個多部分formpost –

+0

@DanielStenberg:不,如果你有它像這個例子中預格式化,這是沒有必要的。 – hakre

0

這樣

$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);   

注:陣列中必須全部發布數據。