Re: Question about urlencode....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



TG wrote:
> Unless your URL is more complicated than your example, you shouldn't need to 
> use urlencode() at all.   You'd need to use it in a case where your string 
> may contain characters that aren't valid in URLs like spaces and such:
> 
> $baseurl = "http://www.somesearchsite.com/search=";;
> $searchfor = "Grace O'Mally";
> 
> $searchurl = $baseurl . urlencode($searchfor);
> 
> Since you set your URL explicitly and it's not something entered by a user, 
> you shouldn't need it.
> 
> Try that and see if it fixes your other problem with double encoding.. or at 
> least gives a better clue as to where it's coming from.


Unfortunately the URLs are of arbitrary complicatedness ;)

Simple CMS system. Can view a profile page of an "entry" and click
through to their website.

I have a leave page that tracks how many clickthroughs.

The URL the user entered could be e.g.
"http://www.site.com/?a=b&something=else";

So if I were to not URL encode the URL I would get an exit link of:
/leave.php?url=http://www.site.com/?a=b&something=else&entry_id=123

As you can see the entry id is now confuses with the original URL and
the fact that there are two ?'s in the query is not particularly nice
either.

So AFAICT I *have* to URL encode them.

I think the only thing I can do is detect the URL starting with
"http[s]%" in the leave.php file and keep decoding until it doesn't....

Seems really hick but what other option is there other than carefully
explaining to google bot to stop doubly encoding things thank you very
much....

Col

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux