## 函數
```
/**
* 發送post請求
* @param string $url 請求地址
* @param array $post_data post鍵值對數據
* @return string
*/
function send_post($url, $post_data) {
$postdata = http_build_query($post_data);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type:application/x-www-form-urlencoded',
'content' => $postdata,
'timeout' => 15 * 60 // 超時時間(單位:s)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
```
## 方法
```
/**
* 測試:php發送post請求
* @link http://www.jb51.net/article/46627.htm
*/
public function test()
{
//使用方法
$post_data = array(
'username' => 'hongwei',
'password' => '02035'
);
send_post('http://tmc/train/callback/pay_callback', $post_data);
}
```
## pay_callback 方法
```
public function pay_callback()
{
// $path ="/home/pay_callback.txt"; //linux
$path ="c:/pay_callback.txt";
file_put_contents($path, json_encode($_POST));
}
```
## 結果

- 回調操作
- 測試post請求
- 一:提交訂單回調
- 二:請求出票回調
- 三:退票回調
- 火車票全部接口
- 1.站點簡碼查詢
- 2.余票查詢
- 3.提交訂單(占座)
- 4.請求出票
- 5.訂單狀態查詢
- 6.線上退票
- 7.歷史訂單查詢
- 8.下載csv格式報表
- 9.取消待支付的訂單
- 10.設置回調
- 11.查詢賬戶余額
- 整理車票API
- 火車票簡碼采集
- 火車票相關
- 火車票相關截圖
- 火車票車型
- 火車票訂單
- 座位類型
- 火車票11個接口封裝后
- 票的狀態
- 聚合聯系方式
- response不支持行內式寫法
- 火車票登錄接口信息
- 火車票回調
- 火車票訂票接口常見問題
- 退票手續費
- 退票返回的信息
- 相關知識
- javascript 日期相減 涉及到時分秒
- 火車票訂單流程
- 火車票提交
- 因公一些權限
- 工具
- 箭頭
- 執行標準和政策詳情
- 執行情況
- 成本中心
- miyou當前用戶及政策相關信息
- 審批信息彈出
- 人員ID姓名與政策ID
- 費用
- 流程
- bookOne
- bookTwo
- booOnePost
- 舊的成本中心
- 成本中心聯動
- 注意事項
- 提交返回的數據 train_all
- 選座
- 易購火車票
- 簽約