PHP: Security when using CURL?

前端 未结 2 524
谎友^
谎友^ 2021-01-25 11:56

I have a page like this. User write an URL into a form and submit. Once the URL is submitted, I connect that page with CURL, search for a string. If it finds the string, it adds

相关标签:
2条回答
  • 2021-01-25 12:44

    I don't see why htmlspecialchars or a Regex would be necessary here, you don't need those. Also, there is no way that PHP will "automatically" parse the content retrieved using cURL. So yes, it is save (unless you do stuff like eval with the output).

    However, when processing the retrieved content later, be aware that the input is user-provided and needs to be handled accordingly.

    0 讨论(0)
  • 2021-01-25 12:48

    curl makes a request and to a server and the server sends back data. If there were an executable file on a web server you'd get back the binary of the file. Unless you write the file to your disk and execute it there should be no problem. Security in that sense should not be an issue.

    0 讨论(0)
提交回复
热议问题