首页 >php教程 >PHP源码 >简单的利用www.vsfxt.com支付宝订单查询系统实现订单查询

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

PHP中文网
PHP中文网原创
2016-05-25 16:59:581495浏览

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 = &#39;http://23.239.194.245:7000/&#39;;//网关
$tradeNo = &#39;2013111200001000920071958757&#39;;//交易号
$info = curl_get_contents($gateway.$tradeNo);
$arr  = json_decode($info);
if(is_object($arr)===false) {
echo &#39;Error&#39;;
}else {
foreach($arr as $key=>$value) {
  echo "交易号:",$key,"<br />","成交金额:",$value->fee,"<br />","成交时间:",$value->time;
}
}
?>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn