I am struggling to POST
JSON
to my localhost, using Curl
from mingw64
.
curl -H 'Content-Type: application/csp-report;charset=utf-8'
--data '{"csp-report":{"document-uri":"https://localhost/test",
"referrer":"https://www.google.com/",
"violated-directive":"default-src self","original-policy":"default-src self; report-uri /csp.php",
"blocked-uri":"http://evilhackerscripts.com"}}'
'https://localhost/csp.php'
Testing some escaping suggested online, resulted into this output:
curl: (6) Could not resolve host: "referrer"
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: "https
curl: (6) Could not resolve host: "violated-directive"
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: "default-src
curl: (6) Could not resolve host: self",
curl: (6) Could not resolve host: "original-policy"
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: "default-src
curl: (6) Could not resolve host: self;
curl: (6) Could not resolve host: report-uri
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: ,"blocked-uri"
curl: (3) URL using bad/illegal format or missing URL
curl: (3) unmatched close brace/bracket in URL position 21:
ERROR: This is also what came up earlier. Works to POST from POSTMAN, but not via curl in Windows Command Prompt via mingw64
Notice: Trying to get property 'csp-report' of non-object in C:\www\testing\csp.php on line 11
Notice: Trying to get property 'document-uri' of non-object in C:\www\testing\csp.php on line 11
Notice: Trying to get property 'csp-report' of non-object in C:\www\testing\csp.php on line 12
Notice: Trying to get property 'referrer' of non-object in C:\www\testing\csp.php on line 12
Notice: Trying to get property 'csp-report' of non-object in C:\www\testing\csp.php on line 13
Notice: Trying to get property 'violated-directive' of non-object in C:\www\testing\csp-reporter.php on line 13
Notice: Trying to get property 'csp-report' of non-object in C:\www\testing\csp.php on line 14
Notice: Trying to get property 'original-policy' of non-object in C:\www\testing\csp.php on line 14
Notice: Trying to get property 'csp-report' of non-object in C:\www\testing\csp.php on line 15
Notice: Trying to get property 'blocked-uri' of non-object in C:\www\testing\csp.php on line 15