uok
(uok)
1
Hello,
I’m trying to put together a simple PHP script
$curl = curl_init("http://example.com:1234/rest/system/config");
curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-API-Key: abcdefg"));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
As result I get “Error 403 - CSRF error”.
What am I missing?
uok
(uok)
3
thanks for the suggestion but it is correct
I also tried switching to HTTPS which needs
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
because of the self signed certificate - but same result.
uok
(uok)
4
if I use this command line it works
curl -H "X-API-Key: abcdefg" http://example.com:1234/rest/system/config
I guess I’ll do this as a bash script then