Re: Splitting up long URLs
| From: | Andrew Ballard | Date: | Tue, 08 Jul 2008 16:05:08 +0000 |
| Subject: | Re: Splitting up long URLs | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276443@lists.php.net to get a copy of this message | ||
On Mon, Jul 7, 2008 at 12:54 PM, tedd <tedd.sperling@gmail.com> wrote:
> At 11:57 AM -0400 7/7/08, Daniel Brown wrote:
>>
>> You could display the URL's the way Google handles them:
>>
>> <?php
>>
>> function shortenURL($longURL) {
>> preg_match('/\/?[a-z0-9\.\-]+\//Ui',$longURL,$matches);
>> $shortURL = str_replace('/','',$matches[0]);
>> return $shortURL;
>> }
>>
>> $longURL =
>>
>> "http://some-SPAM-URL-011.example.com/v14gra/p3n15_pump.php?affil=43ERG3245wert002934&boo=yaa!";
>>
>> echo "<a
>> href=\"".$longURL."\">".shortenURL($longURL)."</a><br
>> />\n";
>> ?>
>>
>
> Very nice.
>
> However, there isn't a way to change what the user see's in the browser's
> url box, is there?
>
> For example, can you send a user to http://example.com/a.php,
> but they see
> http://example.com/b.php in their browser?
>
> Cheers,
>
> tedd
Sounds pretty phishy to me, tedd. :-)
Andrew