1 Star 0 Fork 61

zxlcode/phpapp

forked from 小肥羊/phpapp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
2019043001.php 993 Bytes
一键复制 编辑 原始数据 按行查看 历史
小肥羊 提交于 2019-04-30 10:39 . 学习示例代码
<?php
$host = 'https://dwz.cn';
$path = '/admin/v2/create';
$url = $host . $path;
$method = 'POST';
$content_type = 'application/json';
// TODO: 设置Token
$token = '7c73e4eca9fec21bc9c1bfc361cad288';
// TODO:设置待注册长网址
$bodys = array('url'=>'https://cn.bing.com/');
// 配置headers
$headers = array('Content-Type:'.$content_type, 'Token:'.$token);
// 创建连接
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($bodys));
// 发送请求
$response = curl_exec($curl);
curl_close($curl);
// 读取响应
var_dump($response);
?>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/zxlmin-code/phpapp.git
git@gitee.com:zxlmin-code/phpapp.git
zxlmin-code
phpapp
phpapp
master

搜索帮助