<?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. 《算法》第四章部分程序 part 7

    ▶ 书中第四章部分程序,包括在加上自己补充的代码,图中找欧拉环 ● 无向图中寻找欧拉环 package package01; import edu.princeton.cs.algs4.StdOut; ...

  2. python中的ljust、rjust

    ljust()将字符串左对齐右侧填充 rjust()将字符串右对齐左侧填充 举个例子: 1 a = "hello world" 2 a1 = a.ljust(15, "* ...

  3. redis 安装 ,sea 比较友好的一种

    参考: https://blog.csdn.net/qq_26709459/article/details/80159468 redis 安装与配置 Remark: 请务必开放端口 6379 ,否则其 ...

  4. mac 关于默认python2下的pip,和python3下pip 的坑

    pip是常用的python包管理工具,类似于java的maven.用python的同学,都离不开pip. 1.在Python2.7的安装包中,easy_install.py是默认安装的,而pip需要手 ...

  5. Redis 发布与订阅模式

    subscribe  订阅 publish   发布   频道    发布内容

  6. c++Builder debug DataSet Visualizer

    c++Builder debug DataSet Visualizer delphi 正常,c++builder报错. fdMemTable->SaveToFile("d:\\DSdb ...

  7. js弹出div层内容(按回退键关闭div层及遮罩)

    <!--弹出的div列表对应的详情--> <div id="newhtml" class="white_content"> <di ...

  8. css- 范围选择

    1.子元素范围选择 举例 .iconList_wr li:nth-child(n + 1):nth-child(-n + 4) { margin-right: 0.6rem; } .iconList_ ...

  9. Flex_概念

    1.Flex是事件驱动的面向对象应用程序框架和编程语言.Flex应用程序加载完毕后,需要做的就是捕获事件,然后作出响应.    Flex是一个庞大的技术组群中的一员.  2.RIA(Rich Inte ...

  10. 尚硅谷springboot学习18-日志使用

    默认配置 SpringBoot默认帮我们配置好了日志 //记录器 Logger logger = LoggerFactory.getLogger(getClass()); @Test public v ...