I want to check the headers Permissions-Policy of my website and work with it.
For example, in the way this API does it with www.google.com:
https://api.hackertarget.com/httpheaders/?q=https://www.google.com/
I want to do something like:
if ($PermissionsPolicy->unload == null){
echo 'Unload is not defined';
}
It is any way to do this with PHP or JS?
Thanks!
2
Answers
Yes you can use both language to check the Permissions-Policy headers of a website.
For PHP use get_headers
and for Java Use the Fetch API or XMLHttpRequest
You can check request headers with php
get_headers()
. If you set the second parameter to true you’ll receive an associative array from your HTTP headers, so you can easily identify it.Here’s the docs link:
https://www.php.net/manual/en/function.get-headers.php
After you have the Permission Policy value you should work a bit to extract the single rules. You could explode the string and then make the checks you need on the single values, but that’s up to you, depending on what you need.
Hope this helps