【问题标题】:I would like to send am "http 200" using curl我想使用 curl 发送“http 200”
【发布时间】:2016-12-14 11:55:15
【问题描述】:

我正在响应 Paypal IPN 系统

我想发一个

“HTTP/1.1 200 正常”

在我发送带有数据的php curl 之前

我认为我也应该在 php curl 中执行此操作(而不是 header("HTTP/1.1 200 OK");

谁能提供我的代码?还是标题好吗?

【问题讨论】:

  • HTTP 200 是一个响应状态码。是什么让您认为在发送请求时应该(或可以)发送它?
  • curl_setopt($ch,CURLOPT_CUSTOMREQUEST,"HTTP/1.1 200 OK");大声笑

标签: php http curl


【解决方案1】:
 function curl()
    {
      $ch = curl_init();

      $data = array(
      "Content-type: ,
      "POST /your api curl method HTTP/1.1",
      "Accept: ",
      "Host: "host url",
      "Content-length: your param length
       );

       curl_setopt($ch, CURLOPT_POST, true);
       curl_setopt($ch, CURLOPT_URL, post url here);
       curl_setopt($ch, CURLOPT_HTTPHEADER, $data);
       curl_setopt($ch, CURLOPT_POSTFIELDS, post param here );
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

       $output = curl_exec($ch);

       $err = curl_error($ch);
       curl_close($ch);
       return $output;
    }

应该在标题中发送它

【讨论】:

  • 为什么发送 POST request 会导致包含 response 标头?另外,您缺少报价。请注意提供准确的答案并进行解释。
猜你喜欢
  • 2016-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-12
  • 2016-07-25
  • 1970-01-01
相关资源
最近更新 更多