1 Star 0 Fork 0

硅谷课堂 / wordslibsys

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test.php 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
硅谷课堂 提交于 2020-12-17 18:28 . the project init
<?php
ini_set("display_errors", "on");
$url = "http://filter.chnedu.com/v2/putdata";
$arr = array(
array(
"word"=>"雪狐",
"version"=>'201601',
"type" => "1",
"site" => "0",
"system" => "0",
"iswhitelist" => "0",
"level" => 2,
"create_time" => "2016-09-06 09:33:39",),
array(
"word"=>"huo狐",
"version"=>'201601',
"type" => "1",
"site" => "0",
"system" => "0",
"iswhitelist" => "0",
"level" => 2,
"create_time" => "2016-09-06 09:33:39",),
);
$jsonstr1 = json_encode($arr);
$jsonstr2 = '{"words":'.$jsonstr1.'}';
echo $jsonstr2;
//exit;
$ch = curl_init('http://filter.chnedu.com/v2/putdata');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS,$jsonstr2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($jsonstr2))
);
$result = json_decode(curl_exec($ch),true);
//$result = curl_exec($ch);
var_dump($result);
// var_dump($ch);
PHP
1
https://gitee.com/ggkt/wordslibsys.git
git@gitee.com:ggkt/wordslibsys.git
ggkt
wordslibsys
wordslibsys
master

搜索帮助