首页 > 解决方案 > 谷歌防火墙 API 的 PHP 脚本

问题描述

我正在尝试做一个简单的脚本来更改我的虚拟机主机上的防火墙规则。我用的是google API explorer,生成的脚本如下

 curl --request PUT \  'https://www.googleapis.com/compute/v1/projects/learnstoresg/global/firewalls/intranet2?requestId=00000000-0000-0000-0000-000000000033' \
  --header 'Authorization: Bearer [YOUR_BEARER_TOKEN]' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{"allowed":[{"IPProtocol":"TCP","ports":["4033","4016"]}],"sourceRanges":["101.127.7.227"]}' \
  --compressed

任何人都有用于谷歌防火墙的 php 脚本示例,或者可以帮助我将此 CURL 语句转换为 php 脚本吗?

标签: api

解决方案


推荐阅读