Hello everybody,
I have been pulling my hair out over this issue and hping somebody can help me out.
My provider is using "PHP Version 4.2.2".
I am recieving URLs via a RSS feed and I need to encode these so they pass the W3C Transitional code validation script.
Problem is when I endode the URL String, what I get is very weird! I get MY OWN sites URL prepended to the URL that I just encoded.
This URL I am putting in an HREF tag. If I simply output the URL to the screen it looks fine, no PREPENDED URL at the beginning. BUT when I put in IN the HREF tag, I get this strange behavior.
EXAMPLES:
Resulting source of URL after encoding:
http%3A%2F%2Fwww.43things.com%2Fthings%2Fview%2F384%3Ftest%3D1%26test2%3Dtest2
BUT when I rollover the link, in my status bar I see the following:
http://www.perculator.com/ http%3A%2F%2Fwww.43things.com%2Fthings%2Fview%2F384%3Ftest%3D1%26test2%3Dtest2
*notice the "http://www.perculator.com/ before the real desired URL. Where the heck is this coming from?
Like I said if I DONT put this code in the HREF tag it outprints fine, its only when I put it int he HREF tag..
Here is the PHP I am trying to use. I ran a bunch of tests.
<?php
$link1 = "http://www.43things.com/things/view/384?test=1&test2=test2";
$link2 = urlencode("http://www.43things.com/things/view/384?test=1&test2=test2");
$link3 = rawurlencode("http://www.43things.com/things/view/384?test=1&test2=test2");
$link4 = rawurldecode($link3);
?>
<a href="<?php echo $link1; ?>"><?php echo $link1; ?></a><br/>
<a href="<?php echo $link2; ?>"><?php echo $link2; ?></a><br/>
<a href="<?php echo $link3; ?>"><?php echo $link3; ?></a><br/>
<a href="<?php echo $link4; ?>"><?php echo $link4; ?></a><br/>
Viewing source, or viewing compiled page all show me a correct formetted URL. It's ONLY when I roll over th elink or actually click on it that I get the error page.
-A