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 (freeloader+myaddy@gmail.com). 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 myaddy@gmail.com

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

thanks in advance
Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.