Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 345063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:02:57+00:00 2026-05-12T11:02:57+00:00

I am trying to test some of these code here http://ha.ckers.org/xss.html on my code.

  • 0

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';
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:02:57+00:00Added an answer on May 12, 2026 at 11:02 am

    Another way, maybe a bit easier (you don’t have to escape the quotes, nor double-quotes) would be to use Heredoc syntax :

    $string = <<<STR_1
    <IMG SRC="javascript:alert('XSS');"><b>hello</b> hiii
    STR_1;
    

    Note you’ll still have to escape the $ sign, if you have some, to not have varible interpolation.

    Quoting the manual :

    Heredoc text behaves just like a
    double-quoted string, without the
    double quotes. This means that quotes
    in a heredoc do not need to be
    escaped, but the escape codes listed
    above can still be used. Variables are
    expanded, but the same care must be
    taken when expressing complex
    variables inside a heredoc as with
    strings.

    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)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run PartCover to test the coverage of some tests with
I am trying to test the likelihood that a particular clustering of data has
I am trying to test that a particular method throws an expected exception from
I am trying to test a class that manages data access in the database
I am trying to test a proof of concept that I can run a
I'm trying to test a proposition that one of our vendors presented to us
I'm trying to accomplish the following layout, http://www.rae-mx.com/test/css-layout.jpg and I'm almost there, except for
Really stupid C question. I'm trying to build the source code here so I
I am trying to integrate some new code I wrote for programmatically interacting with
I am currently trying to load some js files asynchronously, so that they are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.