I am trying to test some of these code here http://ha.ckers.org/xss.html on my code. To do so I need to set the codes on that page into a PHP variable, I am having trouble though.
For example this code below is incorrect just for setting it to a variable because of the “code” and ‘code’ the ‘” is what I am talking about. How can I set code from that page or below into a PHP variable for testing?
$string = '<IMG SRC=\"javascript:alert('XSS');\"><b>hello</b> hiii';
Another way, maybe a bit easier (you don’t have to escape the quotes, nor double-quotes) would be to use Heredoc syntax :
Note you’ll still have to escape the $ sign, if you have some, to not have varible interpolation.
Quoting the manual :
Note : read the manual about that : there are some things you must know before using heredoc syntax (like the fact that the closing identifier must be alone on its line)