如何通过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(