37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
// file_put_contents('c:/1.txt', json_encode($_REQUEST));
|
|
|
|
if(!isset($_GET['v']))
|
|
die('没有v参数');
|
|
|
|
$v = json_decode($_GET['v'], true);
|
|
|
|
if(!isset($v['url']))
|
|
die('没有地址');
|
|
|
|
if(!isset($v['params']))
|
|
die('没有参数');
|
|
|
|
//file_put_contents('pay.txt', $_GET['v'].PHP_EOL, FILE_APPEND);
|
|
|
|
// "order_no":"PE164695201711041021473796","out_trade_no":"bd30509462e0b38c0ef2aa32a576b2ad","transaction_id":"4200000004201711042338031287"
|
|
if(isset($_POST['out_trade_no']))
|
|
$v['params']['biz_content']['outtradeno'] = $_POST['out_trade_no'];
|
|
|
|
if(isset($_POST['transaction_id']))
|
|
$v['params']['biz_content']['transactionid'] = $_POST['transaction_id'];
|
|
|
|
//file_put_contents('pay.txt', json_encode($v['params']).PHP_EOL, FILE_APPEND);
|
|
|
|
$param = http_build_query($v['params']);
|
|
|
|
$opts = array(
|
|
'http' => array(
|
|
'method' => 'POST',
|
|
'header' => "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($param) . "\r\n",
|
|
'content' => $param)
|
|
);
|
|
|
|
$context = stream_context_create($opts);
|
|
$ret = file_get_contents($v['url'], false, $context);
|
|
print_r($ret); |