欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

简单的利用www.vsfxt.com支付宝订单查询系统实现订单查询

程序员文章站 2022-05-09 13:38:50
...
php代码
<?php
function curl_get_contents($url) { 
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt ($ch, CURLOPT_TIMEOUT, 5);
$buf = curl_exec($ch);
curl_close($ch);
return $buf;
}
$gateway = 'http://23.239.194.245:7000/';//网关
$tradeNo = '2013111200001000920071958757';//交易号
$info = curl_get_contents($gateway.$tradeNo);
$arr  = json_decode($info);
if(is_object($arr)===false) {
echo 'Error';
}else {
foreach($arr as $key=>$value) {
  echo "交易号:",$key,"<br />","成交金额:",$value->fee,"<br />","成交时间:",$value->time;
}
}
?>