Announcement

Collapse
No announcement yet.

PHP Submit to Web and Apostrophe Marks

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Submit to Web and Apostrophe Marks

    I got the PHP email program that Cory built working, thanks Corey, (Sorry Bruce, I don’t know enough to help you out). I don’t mean to look a gifted horse in the mouth, but I’m having a little problem that maybe someone help with. If the message part of the email contains an apostrophe mark, the resulting email that gets sent adds a backslash. So if I post a message that says Jim’s, the received email says Jim\’s.
    I wonder if there is a way to fix this on the resulting email. I’ve tried to replace the apostrophe mark with the ASCII equivalent, before the post gets sent, but this doesn’t seem to work. Then again I might be doing something wrong. I’ve tried the decimal and the hex ASCII equivalents, (0027 and 039) I tried proceeding them with different combinations of the &, #, And % signs, but I can’t find a combination that works.
    Preferably, I’d like a solution that allows me to replace the character on the AMS side, before the request gets posted to the PHP program, because I’m not smart enough to re-write the PHP program.
    I hope that I made my question clear. Thanks for any suggestions, or help.

  • #2
    Re: PHP Submit to Web and Apostrophe Marks

    Apostrophe is a special character in PHP. \ is the escape character operator in PHP. So for example if I am typing:

    $name = "William Morris";

    There's no problem but if I type:

    $name = "William "The Brainiac" Morris";

    It causes an error because PHP only sees it as

    $name = "William "

    and then a whole bunch of jibberish. So instead we escape the quotations as such:

    $name = "William \"The Brainiac\" Morris";

    And that way PHP knows those two quotation marks aren't related to the opening and closing qoutation marks. So if you escape the quotations in your string you should be okay, but I can't say 100% for sure without seeing the code. You can escape quotations in a string by adding this to the code just before the email gets sent:

    $emailBodyText = eregi_replace("'", "\'", $emailBodyText);

    Or at least I think so. I just sort of rushed through this without thinking but anyhow if you want to upload you code I can try and fix it for you...

    Corey Milner
    Creative Director, Indigo Rose Software

    Comment


    • #3
      Re: PHP Submit to Web and Apostrophe Marks

      Hey Jims no prob! No one else can seem to get it to work for me either!

      Comment


      • #4
        Re: PHP Submit to Web and Apostrophe Marks

        Ah yes I remeber testing it, works just fine on two separate tera-byte servers, the IR server, and the Liquidhoster Server. Not sure what's up with your email Bruce but you should look into a 4U account with tera-byte, $9 per month ofr 400 MB space with all the bells and whistles you'd ever want and it's high speed 24/7, I've hosted through them for years with several different domains and never had a single tiny hassle, ever. If you prepay the year it's $99.

        Anyhow I can guarantee the script works on servers with properly configured mail servers, past that it's out of me hands boyo.

        Corey Milner
        Creative Director, Indigo Rose Software

        Comment


        • #5
          Re: PHP Submit to Web and Apostrophe Marks

          Thanks for the quick reply. I’m not sure I asked my question very well though. I have tried to replace the apostrophe with a backslash apostrophe
          Jim’s
          re0laced wi4h Jim\’s
          before I send (post) the request to the PHP program, but then the resulting email says
          Jim\\’s

          I’ll write the replace code, after I figure out a character string that works. Here is a simple version

          %To% = "[email protected]"
          %From% = "[email protected]"
          %Subject% = "You got mail"
          %Message% = "Jim's Jim\'s Jim#0027s Jim&#0027s Jim#039s Jim&#039s"
          Internet.SubmitToWeb (POST, "http://www.pendletonnet.com/00test/test4.php", "to;;%To%;;from;;%From%;;message;;%Message%;;subje ct;;%Subject%")


          The email message that gets sent says
          Jim\'s
          Jim\\'s
          Jim#0027s
          Jim&#0027s
          Jim#039s
          Jim&#039s

          I’m trying to figure out how to have the resulting email that goes to [email protected] say
          Jim’s

          I hope that that better explains my problem. Thanks

          Comment


          • #6
            Re: PHP Submit to Web and Apostrophe Marks

            Thx for the info Corey.

            Comment


            • #7
              Re: PHP Submit to Web and Apostrophe Marks

              Bruce, I’m a bit out of my league making any suggestions on this, but here goes. On the server I’m using, I have a couple of different websites (URLs) sharing the same IP address. They call this virtual domains.
              The Get, Post, functions only work if the file is on the main URL.
              My main domain is www.pendletonnet.com and I have www.rigsnw.com as a virtual domain.
              If I want to download a file from the web, or use the Post/Get functions, the files need to be located at a www.pendletonnet.com address. It won’t find the file if I place it at a www.rigsnw.com address.
              The web browser object has no problems seeing the virtual domains, just the internet functions. This took me a while to figure out.

              I don’t know if this has anything at all to do with your difficulties. I hope this helps. If not, sorry but that’s the only suggestion I can come up with. Anything else is over my head. If this isn’t your problem, then I’d second Corey’s suggestion, because his code works on my server too. This was the very first PHP program I’ve used, and after I figured out the virtual domain thing, it worked first try.
              Good luck

              Comment


              • #8
                Re: PHP Submit to Web and Apostrophe Marks

                Hey Jim-
                I am really glad this has worked out for you. To be honest I don't know what the issue is for me. My server is emailing me back only using the workaround. I'll take your suggestions and see how they could apply to me. Thx!

                Comment

                Working...
                X