我正在努力POST
JSON
到我的本地主机,使用Curl
从**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'
测试一些在线建议的转义,得到以下输出:
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:
错误:这也是之前出现的问题。可以从POSTMAN进行POST,但不能通过mingw 64在Windows命令提示符下使用curl
注意:尝试获取C:\www\testing\csp.php第11行非对象的属性'csp-report'
注意:尝试获取C:\www\testing\csp.php第11行的非对象属性'document-uri'
注意:尝试获取C:\www\testing\csp.php第12行非对象的属性'csp-report'
注意:C:\www\testing\csp.php第12行,尝试获取非对象的属性'referrer'
注意:尝试获取C:\www\testing\csp.php第13行非对象的属性'csp-report'
注意事项:C:\www\testing\csp-reporter.php第13行尝试获取非对象的属性'violated-directive'
注意:尝试获取C:\www\testing\csp.php第14行非对象的属性'csp-report'
注意:C:\www\testing\csp.php第14行尝试获取非对象的属性'original-policy'
注意:尝试获取C:\www\testing\csp.php第15行非对象的属性'csp-report'
注意:尝试获取C:\www\testing\csp.php第15行的非对象属性'blocked-uri'
2条答案
按热度按时间myzjeezk1#
也许你应该像这样在单行中运行curl命令:
或者,你可以在每一行后面添加一个反斜杠,告诉shell你的命令还没有结束:
希望能帮到你。
gz5pxeao2#
这个名为post.sh的小脚本为我工作:
这样称呼它:
传入一个新号码会在服务器上创建一个新用户。
样品运行: