2011-01-25 23 views
0

次の形式のデータを受け入れるサーバーにデータを送信しようとしています VERIFY_DATA=MER_ID=xxx|MER_TRNX_ID=xxx| MER_TRNX_AMT=xxx 次のような行はありますか?カールを使用してデータを送信

$datatopost="VERIFY_DATA=MER_ID=xxx|MER_TRNX_ID=xxx| MER_TRNX_AMT=xxx"; 
curl_setopt ($ch, CURLOPT_POSTFIELDS,$datatopost);<br /> 

私はカールで新しくなりました。

答えて

1

この方法を正しく使用するには、articleを使用します。

私は個人的にここに私の

$data="from=$from&to=$to&body=".urlencode($body)."&url=$url"; 
//$urlx contains the url where you want to post. $data contains the data you are posting 
//$resp contains the response. 
     $process = curl_init($urlx); 

     curl_setopt($process, CURLOPT_HEADER, 0); 

     curl_setopt($process, CURLOPT_POSTFIELDS, $data); 

     curl_setopt($process, CURLOPT_POST, 1); 

     curl_setopt($process, CURLOPT_RETURNTRANSFER,1); 

     curl_setopt($process,CURLOPT_CONNECTTIMEOUT,1); 

     $resp = curl_exec($process); 

     curl_close($process); 
0

のプロジェクトでそれを行うには、このコードを使用するには、PHPでの実施例です。これはFXの見積もりを求めて返します。私のデータリクエストはあなたのURLがポストフィールドにありますので調整する必要があります。あなたが "x | ME"を渡しているデータにスペースがあるように見えますが、そうは思わないでしょう。

$ch = curl_init(); // initialise CURL 
// set URL and other appropriate options 
curl_setopt($ch, CURLOPT_URL, $curl_opt_string); // this contains the URL and the request 
curl_setopt($ch, CURLOPT_HEADER, false); // no header 
curl_setopt($ch, CURLOPT_INTERFACE, "93.129.141.79"); // where to send the data back to/outgoing network 
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); // tell it what the agent is 
curl_setopt($ch, CURLOPT_POST, 1); // want the data back as a post 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return as a string rather than to the screen 
$output = curl_exec($ch); // varu=iable to return it to 

curl_close($ch); // close cURL resource, and free up system resources 

$subject = $output; // get the data 

$curl_opt_string = "http://msxml.rexefore.com/index.php?username=MiJoee4r65&password=L8e44Y&instrument=245.20." . $lhsrhs . "LITE&fields=D4,D6"; 
を次のように私は私の出力刺さを構築
関連する問題