关于php:php-curl

71次阅读

共计 523 个字符,预计需要花费 2 分钟才能阅读完成。

// Generated by ApiPost: https://www.apipost.cn/
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, ‘{{website}}/api/user/login’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$post = array(

'phone' => '18825132454',
'code' => '456789',
'type' => 'code'

);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

$headers = array();
$headers[] = ‘User-Agent: Apipost client Runtime/+https://www.apipost.cn/’;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {

echo 'Error:' . curl_error($ch);

}
curl_close($ch);

正文完
 0