Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: URL Encoding

  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts

    URL Encoding

    Okay, I'm trying to pass some actual XML codes from javascript to PHP with the $_get superglobal, and then PHP writes it to an XML file. It writes everything, but puts backslashes (\) before all the quotes, even when I "URL-encode" them. Any ideas?

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    You probably have magic_quotes on. Try putting this at the top of your script:
    PHP Code:
    if(get_magic_quotes_gpc())
        
    $xmldata stripslashes($_GET['xmldata']);
    else
        
    $xmldata $_GET['xmldata']; 
    Change the name of the field to the one you use of course, and change the file data variable to $xmldata.
    Last edited by Inigoesdr; 11-10-2007 at 08:40 PM. Reason: Forgot the else..

  • Users who have thanked Inigoesdr for this post:

    binaryWeapon (11-10-2007)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •