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

  • SEARCH
  • Home
  • 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 6770117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:16:26+00:00 2026-05-26T15:16:26+00:00

I am passing a textarea input boxs’ contents via POST to my php file

  • 0

I am passing a textarea input boxs’ contents via POST to my php file from html (no javascript allowed).

I then use simplexml to get the feed at the url the user entered.

Unfortunately, the user can enter anything into the textarea. Which I am told is dangerous.

What is the recommended way to clean and secure the POST contents using PHP to get them ready and safe for the simplexml procedure?

(basically, to be sure they are not malicious and check they are a valid url)

  • 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-26T15:16:27+00:00Added an answer on May 26, 2026 at 3:16 pm

    Content inside a $_POST array are strings, so there’s nothing ineherently unsafe there.

    1. User enters php code? It surely won’t be executed, so no problem here (this, among many others, is a reason not to use such things as eval()). So whatever php function or command he writes it will be read as a simple string, and string are no harmful whatever they contain.
    2. User enters malicious javascript? Still no problem, as javascript inside php, or inside a database for what that matters, is pretty useless since it needs a browser to execute.

    This leads to the real issue: user supplied contents needs to be “sanitized” only right before passing it to the target medium. If you’re going to feed a database , use the escaping tools provided by your engine. If you’re going to output it on the webpage, that’s when you need to sanitize from malicious XSS attacks.

    Sanitizing a POST array per se , before actually doing anything with its content, is wrong as you never know for sure when and where that content needs to be used; so don’t even think to use strip_tags() or analogue functions that comes to your mind right after you get the POST value, but pass it as is and add the necessary escaping/sanitizing just when needed.

    What you actually need to do, then, you only know, so act accordingly

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

Sidebar

Related Questions

In a PHP script I'm accepting input from the user from a textarea and
I have a text input and a textarea and I'm passing the value from
passing post data using cURL requires that the name of the input. However, I
I have a problem of passing data from one textarea to another textarea on
I have tinyMCE editor which is passing data to php processing file. If I
I am passing the values from a textarea into a div as such: $(#string).on(keyup
warning: passing argument 1 of 'bsearch' makes pointer from integer without a cast and
I'm passing raw HTTP requests to an apache server (received by PHP). The request
I have this form: <form action=contact.php method=post id=contactform> <ol> <li> <label for=name>First Name *
When pasting a formatted text copied from MS Word into textarea , it will

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.