如何通过PHP curl发送ASP中的数据 [英] How do I get data in ASP sent through a PHP curl

查看:129
本文介绍了如何通过PHP curl发送ASP中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的PHP代码的最后一位看起来像这样:



the last bit of my php code looks like this:

$curl = curl_init("../s/r.asp"); // the URL that processes your POST

curl_setopt($curl, CURLOPT_POST, true); // use POST method
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json")); // set POST header
curl_setopt($curl, CURLOPT_POSTFIELDS, $json); // set POST body

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // send output to a variable for processing
curl_setopt($curl, CURLOPT_HEADER, true); // set to true if you want headers in the output
curl_setopt($ch, CURLOPT_NOBODY, true); // set to true if you do not want the body
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); // set to false if you want to see what redirect header was sent

$output = curl_exec($curl);


if ($output === false)
  {
    //if the request doesn't send 
    echo 'Curl error: ' . curl_error($curl). '<br />';
    echo 'Curl info: ' . curl_getinfo($curl). '<br />';
    curl_close($curl);
  }
  //Success
  else
  {
    //Close connection
    curl_close($curl);
}





但是现在,我必须在asp中解码和打印数据。我不知道从哪里开始。如果有人可以提供一些指导或一些类似的示例代码,我可以用来了解我如何开始,这将是值得赞赏的。



我尝试过:



我读过有关Dim reader As New System.IO.StreamReader(HttpContext.Current.Request.InputStream)

但我又不知道如何开始



But now, I have to decode and print the data in asp. I don't exactly know where to start. If anyone can provide some guidance or some similar sample code that I can use to understand how I can start that would be appreciated.

What I have tried:

I have read about Dim reader As New System.IO.StreamReader(HttpContext.Current.Request.InputStream)
but again im not sure how to even start

推荐答案

curl = curl_init(../ s / r.asp); //处理POST的URL

curl_setopt(
curl = curl_init("../s/r.asp"); // the URL that processes your POST curl_setopt(


curl,CURLOPT_POST,true); //使用POST方法
curl_setopt(
curl, CURLOPT_POST, true); // use POST method curl_setopt(


curl,CURLOPT_HTTPHEADER,array(Content-type:application / json)); //设置POST标头
curl_setopt(
curl, CURLOPT_HTTPHEADER, array("Content-type: application/json")); // set POST header curl_setopt(


这篇关于如何通过PHP curl发送ASP中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆