Hello,
I’m trying use CURL command in a php script to get show configuration (JSON format)
CLI COMMAND :
curl -X POST -F data=‘{“op”: “showConfig”, “path”: }’ -F key=99112200f -k https://192.168.1.16/retrieve
RESULT :
- “success”:true,
- “data”:{
- “interfaces”:{
- “ethernet”:{
- “eth0”:{
- “address”:“dhcp”,
- “duplex”:“auto”,
- “hw-id”:“08:00:27:1d:88:6f”,
- “smp-affinity”:“auto”,
- “speed”:“auto”},
- “eth1”:{
- “address”:“172.16.0.1/24”,
- “duplex”:“auto”,
- “hw-id”:“08:00:27:8f:dc:fc”,
- “smp-affinity”:“auto”,
- “speed”:“auto”}},
- “eth0”:{
- “loopback”:{
- “lo”:{}}},
- “ethernet”:{
- “nat”:{
- “source”:{
- “rule”:{
- “1”:{
- “outbound-interface”:“eth0”,
- “source”:{
- “address”:“172.16.0.0/24”},
- “translation”:{
- “address”:“masquerade”}}}}},
- “1”:{
- “rule”:{
- “source”:{
- “service”:{
- “https”:{
- “api”:{
- “keys”:{
- “id”:{
- “REST”:{
- “key”:“99112200f”}}}},
- “REST”:{
- “id”:{
- “keys”:{
- “certificates”:{
- “system-generated-certificate”:{
- “lifetime”:“65535”}},
- “system-generated-certificate”:{
- “listen-address”:{
- “*”:{}}},
- “api”:{
- “snmp”:{
- “contact”:“Fabien GRAGLIA”,
- “description”:“VyOS-VR”,
- “location”:“FRANCE”,
- “v3”:{
- “engineid”:“0x81f998b699aaf8c2cfb9a6bed9da764e60f6”,
- “group”:{
- “GV3”:{
- “mode”:“ro”,
- “seclevel”:“auth”,
- “view”:“defaultview”}},
- “GV3”:{
- “user”:{
- “V3”:{
- “auth”:{
- “encrypted-key”:“0xcd0d4d3f6f6de48cbaac022279aabcf790047757”,
- “type”:“sha”},
- “group”:“GV3”,
- “mode”:“ro”,
- “privacy”:{
- “encrypted-key”:“0xcd0d4d3f6f6de48cbaac022279aabcf7”,
- “type”:“des”}}},
- “auth”:{
- “V3”:{
- “view”:{
- “defaultview”:{
- “oid”:{
- “1”:{}}}}}},
- “oid”:{
- “defaultview”:{
- “ssh”:{
- “listen-address”:“192.168.1.16”,
- “port”:“666”}},
- “https”:{
- “system”:{
- “config-management”:{
- “commit-revisions”:“100”},
- “console”:{
- “device”:{
- “ttyS0”:{
- “speed”:“115200”}}},
- “ttyS0”:{
- “device”:{
- “host-name”:“vyos”,
- “login”:{
- “user”:{
- “vyos”:{
- “authentication”:{
- “encrypted-password”:“$6$O5bbPP.gmb$CBTvZnnNbrt9nQ2NmgCe11rux9XOJS6aWQGTtyyuUALeGsRqpr7N885Wd5UcYCzKYO0MXG8XcxzO1f9MeFUjQ1”,
- “plaintext-password”:“”},
- “level”:“admin”}}},
- “authentication”:{
- “vyos”:{
- “user”:{
- “ntp”:{
- “server”:{
- “0.pool.ntp.org”:{},
- “1.pool.ntp.org”:{},
- “2.pool.ntp.org”:{}}},
- “server”:{
- “syslog”:{
- “global”:{
- “facility”:{
- “all”:{
- “level”:“all”},
- “protocols”:{
- “level”:“info”}}}},
- “all”:{
- “facility”:{
- “global”:{
- “time-zone”:“Europe/Paris”}},
- “config-management”:{
- “interfaces”:{
- “error”:null
PHP file TEST :
PHP EXECUTION :
PHP Notice: Array to string conversion in /usr/share/nginx/html/templated-visualize/php/SHOWCMD.php on line 28