站点防火墙频率api php案例
<?php
$apiHost = "http://35.201.139.124/api2/site/index.php";
$router = "token";
$url = $apiHost."/".$router;
$uid = 26751;
$skey = "9rSpuRKTpWxR8Daq";
$vhost = "test"; $t = time();
$sign = md5(md5($uid.$skey).$t); $param = sprintf("uid=%d&t=%d&sign=%s&vhost=%s",$uid,$t,$sign,$vhost); function httpRequest($url,$param,$method="POST")
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
$response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$err = curl_error($ch);
curl_close($ch);
$body = substr($response,$headerSize);
if($httpCode > 400){
return false;
}
return $body;
}
//获取token
$response = httpRequest($url,$param);
$responseArray = json_decode($response,true);
if ($responseArray['status']['code'] != 1) {
die("token request failed error=".$responseArray['status']['message']);
}
$token = $responseArray['token'];
echo "token=".$token."<br>"; $siteRouter = "firewall/ipfrequency";
$url = $apiHost."/".$siteRouter;
$id = 1;
$param = sprintf('token=%s&uid=%d&vhost=%s&id=%d',$token,$uid,$vhost,$id);
$response = httpRequest($url, $param,"DELETE");
$responseArray = json_decode($response,true);
if ($responseArray['status']['code'] != 1) {
die("delete request failed error=".$responseArray['status']['message']);
}
die("delete success");
站点防火墙频率api php案例的更多相关文章
- 站点防火墙api,增加黑名单IP接口,增加用post,修改用put,php案例
<?php $apiHost = "http://192.168.1.198/api2/site/index.php"; $router = "token" ...
- 常用免费快递查询API对接案例
现在许多电商公司和ERP都会寻找比较适用的集成快递查询接口,减少对接难度,现在整理一下常用的免费快递查询接口,并附上调用案例,如果有觉得不对的地方,望能够一起沟通探讨! 一.快递查询接口 目前有提供免 ...
- python为在线漫画站点自制非官方API(未完待续)
接下来将记录我一步一步写一个非官方API的过程,由于一些条件的约束,最后的成品可能非常粗暴简陋 如今介绍要准备的全部工具: 系统:ubuntu 14.04 语言:python 2.7 须要自行安装的库 ...
- JAVA Excel API学习案例
先贴代码吧,执行一下.看看效果,然后看看凝视,再看看代码后面的基础介绍 创建一个新excel并写入数据: public static void myExcel2() throws IOExceptio ...
- [SPDK/NVMe存储技术分析]013 - libibverbs API应用案例分析
本文是对论文Dissecting a Small InfiniBand Application Using the Verbs API所做的中英文对照翻译 Dissecting a Small Inf ...
- 【翻译】CSS Animations VS the Web Animations API:案例学习
原文地址:CSS Animations vs the Web Animations API: A Case Study May 03, 2017 css, javascript 上周我写了我如何使用C ...
- 百度地图web api使用案例
效果如下: 1.获取位置的经纬度: 如坐标:114.110033,22.541098 获取经纬度: http://api.map.baidu.com/lbsapi/getpoint/index.htm ...
- cdnbest的proxy里api用法案例:
用户的proxy帐号里api key要设置好,那个key设置后是不显示的,但会显示已设置 key是自已随便生成的 $uid = 22222; $skey = 'langansafe&*#'; ...
- DataFrame API应用案例
DataFrame API 1.collect与collectAsList . collect返回一个数组,包含DataFrame中的全部Rows collectAsList返回一个Java List ...
随机推荐
- 500 OOPS: could not read chroot() list file:/etc/vsftpd/chroot_list
出错原因:用户没有变更根目录的权限. ftp用户默认的根目录是/home/ftp,如果要切换登陆目录,需要给予权限 解决方法: 第一步, 打开/etc/vsftpd/vsftpd.conf,做如下配置 ...
- 【Excel技能】字符串包含某字符串个数?替换许多组字符串?
=len(单元格A)-len(substitute(单元格A,某字符串,)) 原理:将某字符串替换成空,前后字符串长即为减去的这个字符串长度,这个字符串出现个数=前后字符串长度之差/这个字符串长度 = ...
- SimpleDateFormat线程不安全
http://www.cnblogs.com/peida/archive/2013/05/31/3070790.html dateUtil替换
- maven包下载失败
使用文件搜索工具(楼主用的是 Everything) 输入.lastupdate删除所有以.lastupdate结尾的文件.然后简单修改.pom(比如加空格) 保存,然后eclipse就会重新下载ja ...
- $(document).ready和window.onload 简单分析区别
<锋利的JQuery>翻开没看几页,就遇到了这个神奇的问题,之前在橙旭园学习的时候,JQuery只教了一些基础的,像链式操作等,那时以为这个和window.onload()差不多一模一样, ...
- ndoejs处理编码的爬虫
var express=require('express');var http=require('http');var cheerio=require('cheerio');var fs=requir ...
- 在keil调用Notepad++
先打开keil, 新建一个 取名为notepad 选择notepad++的安装路径 设置参数 保持后可以看多了notepad的选项 运行当前的文件在notepad++打开
- [转]USB之Part 4 - Protocol
原地址http://www.usbmadesimple.co.uk/ums_4.htm Controlling a Device Before we go into detail, we need t ...
- Spring Cloud(2)A Eureka server端 服务注册建立
1. 父项目pom <dependency> <groupId>org.springframework.cloud</groupId> <artifactId ...
- Runnable接口和Callable接口的区别。
Callable需要实现call方法,而Runnable需要实现run方法:并且,call方法还可以返回任何对象,无论是什么对象,JVM都会当作Object来处理.但是如果使用了泛型,我们就不用每次都 ...