Jump to content

"+" sign


freeloader

Recommended Posts

Hi guys,

I'm writing a prog that gives an email through a form to a website. I'm using gmails trick ([email protected]). I give the program the email value and have it echo it to be sure.

[code]echo "$email\n";[/code]

It displays it correctly.

Then I give it to the website through cURL.

[code]"&password=mypass&email=".$email."&password2=mypass&email2=".$email."[/code]

The postfield goes on but that's the important part.

Now when I check it with echo, I notice he didn't send the + sign to the server. This is what he sends as email address:
freeloader [email protected]

Instead of "+" he used a space character. Any way to fix this?

thanks in advance
Link to comment
https://forums.phpfreaks.com/topic/28372-sign/
Share on other sites

A plus sign in a URL is an alternate version of an urlencoded space.

You can solve this by urlencoding the text before you pass it, so the plus sign becomes "%2B" in the URL. When the recieving script get it, this will be translated back to "+".

[code]<?php
"&password=mypass&email=".urlencode($email)."&password2=mypass&email2=".urlencode($email)."
?>[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/28372-sign/#findComment-129776
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.