Thanks, yes it did work in a mailto, I was thrown off track by just returning it as plain text. So I right in saying, the browser only converts this when in a href mailto:
I’m having lots of Paypal Buttons buttons on a site, and setting the email globally in one page on the site (entered by the user on the server side page), and then getting PHP to Populate each button with this global email - but keeping the button hidden from spambots.
The PHP encoded email does not work when sent through to the PayPal Cart. But if the email is encoded in entities like Freeway it works in the Paypal Cart.
Can PHP encode emails into entities? or any advice for a possible encoded email PHP solution?
I’m not sure. Try adding it. It might be part of the encoding
process, but if you got a good result from the original method, you
could leave it out.
Another way to do this is as follows:
$encrypted = rawurlencode($email);
It’s a native (written in C) method of PHP, so you don’t need to
write a function to do the same thing, which then needs to be
interpreted and run (microscopically longer execution time on a
modern server).
Walter
On May 1, 2008, at 3:53 AM, WebWorker wrote:
Walter,
Thanks, yes it did work in a mailto, I was thrown off track by just
returning it as plain text. So I right in saying, the browser
only converts this when in a href mailto:
This may be related to the other issue you noted with the missing -1.
Do try the native rawurlencode method first, as it’s both faster and
more expressive (you will have less trouble figuring out what it does
in three months when you look at the code again).
Walter
On May 1, 2008, at 4:32 AM, WebWorker wrote:
The PHP encoded email does not work when sent through to the PayPal
Cart. But if the email is encoded in entities like Freeway it
works in the Paypal Cart.
Oh, sorry, no. My mistake. It won’t fool much of anyone. Let’s try to
get the original form to work correctly. IF you add the -1 back in,
does it do anything different?
Walter
On May 1, 2008, at 9:17 AM, WebWorker wrote:
If I try the rawurlencode only a @ sign is changed to a %40 the
rest of a email remains intact.
It might be helpful then to see the code you are using in PayPal –
any special codes redacted, naturally.
It shouldn’t be hard to do the encoding the way Freeway does, it’s
just converting each character to its numerical equivalent and
encoding it as an HTML entity.
the $email being plain old text that works when sent to the Paypal cart, or the encoded “%6d%61%69%6c%40%64%6f%6d%61%69%6e%2e%63%6f%6d” that does not work in the cart.
So perhaps I should not be using just $email or something else?
If you just type your e-mail address in plain text, and then have
freeway encode it, you could copy and paste that in place of $email.
Or try my function (not tested, but it ought to work) and use that.
I am truly happy to help where I can. Many of you don’t remember me
from 1997 when I joined this list and asked more questions than I
answered. I was trained by Jesuits (high school) to be a “man for
others” and to give of what I was given. AMDG!
Walter
On May 1, 2008, at 11:25 AM, WebWorker wrote:
I apologuise to you Walter for asking again, but it seems you are
the be the only one around to offer help. I feel guilty for once
again asking after floundering.