| 1234567891011121314151617181920212223242526 |
- <?php
- /**
- * POST请求
- * @param $postdata
- * @return bool|string
- */
- function xcurl($url, $postdata) {
- $ch = curl_init();
- curl_setopt($ch,CURLOPT_URL,$url); //支付请求地址
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json; charset=utf-8',
- 'User-Agent: uni-php-sdk/0.1.0',
- ));
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postdata));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $response=curl_exec($ch);
- curl_close($ch);
- return $response;
- }
|