<?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案例的更多相关文章

  1. 站点防火墙api,增加黑名单IP接口,增加用post,修改用put,php案例

    <?php $apiHost = "http://192.168.1.198/api2/site/index.php"; $router = "token" ...

  2. 常用免费快递查询API对接案例

    现在许多电商公司和ERP都会寻找比较适用的集成快递查询接口,减少对接难度,现在整理一下常用的免费快递查询接口,并附上调用案例,如果有觉得不对的地方,望能够一起沟通探讨! 一.快递查询接口 目前有提供免 ...

  3. python为在线漫画站点自制非官方API(未完待续)

    接下来将记录我一步一步写一个非官方API的过程,由于一些条件的约束,最后的成品可能非常粗暴简陋 如今介绍要准备的全部工具: 系统:ubuntu 14.04 语言:python 2.7 须要自行安装的库 ...

  4. JAVA Excel API学习案例

    先贴代码吧,执行一下.看看效果,然后看看凝视,再看看代码后面的基础介绍 创建一个新excel并写入数据: public static void myExcel2() throws IOExceptio ...

  5. [SPDK/NVMe存储技术分析]013 - libibverbs API应用案例分析

    本文是对论文Dissecting a Small InfiniBand Application Using the Verbs API所做的中英文对照翻译 Dissecting a Small Inf ...

  6. 【翻译】CSS Animations VS the Web Animations API:案例学习

    原文地址:CSS Animations vs the Web Animations API: A Case Study May 03, 2017 css, javascript 上周我写了我如何使用C ...

  7. 百度地图web api使用案例

    效果如下: 1.获取位置的经纬度: 如坐标:114.110033,22.541098 获取经纬度: http://api.map.baidu.com/lbsapi/getpoint/index.htm ...

  8. cdnbest的proxy里api用法案例:

    用户的proxy帐号里api key要设置好,那个key设置后是不显示的,但会显示已设置 key是自已随便生成的 $uid = 22222; $skey = 'langansafe&*#'; ...

  9. DataFrame API应用案例

    DataFrame API 1.collect与collectAsList . collect返回一个数组,包含DataFrame中的全部Rows collectAsList返回一个Java List ...

随机推荐

  1. html-prepend

    $('.classDiv').prepend('<span>添加</span>')

  2. mac python3安装virtualenv出现的问题

    pip3 install virtualenv pip3 install virtualenvwrapper 安装成功后可能 找不到该命令, 解决办法 1.在 vim ~/.bashrc export ...

  3. ansible安装使用入门

    生成对称密钥 执行以下命令,会在当前用户的.ssh目录下生成id_rsa和id_rsa_pub两个文件. ssh-keygen -t rsa root用户:/root/.ssh 普通用户:/home/ ...

  4. IntelliJ IDEA 添加junit插件

    一.使用idea做junit测试需要添加junit插件 1.安装插件 File-->settings-->Plguins-->Browse repositories-->输入J ...

  5. python中strip、startswith、endswith

    strip(rm)用来删除元素内的空白符: rm对应要删除空白符的元素,当rm为空(strip())时删除所有元素的空白符 startswith.endswith用来查找开头或结尾条件的元素 例子: ...

  6. python中的remove

    remove()从左到右寻找,移除找到的第一个指定元素,举个例子: 1 a = ["hello", "world", "world", &q ...

  7. centos7挂载本地yum文件

    https://www.cnblogs.com/aenjon/p/4081794.html

  8. 输出1到n以内的素数

    package cn.lhj.learn; /** * 输出1~n以内的素数 * * @author lhj * */ public class TestSuShu { public static v ...

  9. PC浏览器播放m3u8

    HLS(HTTP Live Streaming)是苹果公司针对iPhone.iPod.iTouch和iPad等移动设备而开发的基于HTTP协议的流媒体解决方案.在 HLS 技术中 Web 服务器向客户 ...

  10. J2SE 8的流库 --- 生成流

    本文介绍了如何产生J2SE 8的流, 包括基本类型的流IntStream, LongStream, DoubleStream . 展现流的方法 public static <T> void ...