【问题标题】:Is this curl post or get?这是卷曲的帖子还是得到?
【发布时间】:2014-06-11 04:00:33
【问题描述】:

我有一个php代码:

$url='https://payment.testingfc.com/TokenPayment.jsp?merchantId='. $merchantid .'&data='.$desEncryptedData; 

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$auth = curl_exec($curl);

这是 curl POST 还是 GET?

【问题讨论】:

    标签: php curl


    【解决方案1】:

    除非您指定 POST.. 它是 GET。

    【讨论】:

      【解决方案2】:

      您可以像这样将其设为 POST:

      <?php
      
      $post_data = array('merchantId'=>$merchantid, 'data'=>$desEncryptedData);
      
      $curl = curl_init('https://payment.testingfc.com/TokenPayment.jsp');
      
      curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($curl, CURLOPT_POST, 1);
      curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
      
      $result = curl_exec($curl);
      
      ?>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-08-14
        • 2019-08-11
        • 1970-01-01
        • 2010-09-22
        相关资源
        最近更新 更多