Thanks for your help on this!

Because the links that are on the HTML pages won't be determined by myself
(and won't be encoded), I need to encode them when they are read by the
script. All that I do is put the call to the php script onto the link. So
what I tried to do is plugged the code below

urlencode($url) right into the frame call itself.

<frame name="textarea" src="<? echo $url=urlencode($url); ?>">

But of course that doesn't work because I'm still running into the 404
error.

Can I encode the $url taken in from the browser then decode it in the
output? Since I can't store the links in the script or in a database, the
url won't be encoded.

It works just fine if I link to ...

frame.php?x=frame&url=http%3A%2F%2Fwww.mls.ca%2Fbin%2Furllink.exe%3Freq%3Dre
altor%26x_aid%3D11111%26x_bid%3d0

but not

frame.php?x=frame&url=http://www.mls.ca/bin/urllink.exe?req=realtor&x_aid=11
111&x_bid=0

Is there any way around this?

Thanks again for your input!

__________________
Jason Dulberg
Extreme MTB
http://extreme.nas.net


> You can encode URLs with urlencode() and decode them by using
> urldecode()...
>
> try read here:
>
> www.php.net/urlencode
> www.php.net/urldecode
>
>
> ### my way:
> ### you pass $url:
>
> $url = www.maxim.cx/get.php?this=variables&as=many&as=you&what=want
> echo "<a href=\"$PHP_SELF?url=".urlencode($url)."\">";
>
>
> ### and you catch it with:
>
> <?
>
tch($x){ 
> case "frame": 
> ?>
>       <frameset framespacing="0" border="0" frameborder="NO" rows="135,*">
>       <frame name="top" src="header.shtml" marginwidth="0"
> marginheight="0" scrolling="NO" noresize>
>       <frame name="textarea" src="<? echo urldecode($url); ?>"> 
> <? 
> break; 
> } 
> ?>
> 
> 
> 
> Cheers,
> Maxim Maletsky
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Jason Dulberg [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 06, 2001 3:09 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] framing search results
> 
> 
> I'd like to create a script that will frame search results made by various
> databases. I will be hardcoding these links into an HTML page. Since there
> will be alot of these links and I will be using the script across several
> virtual hosts, I can't have the links built by a db as they link 
> to offsite
> stuff.
> 
> My problem so far is that if I try to link to a search result (which is
> obviously built by a database), I get a bunch of errors because 
> the &, =, ?
> etc. fields are dropped. So basically, I need to escape the ?,&'s etc. in
> the url. I can do this in perl (cgi::escape) but I'm not quite sure how to
> do it in php. Couldn't get it to work properly in perl so I'm 
> crossing over
> to PHP to see if its doable.
> 
> Here's what I got from a code example from zend.com. Basically, I 
> just need
> to add the %3A etc onto $url.
> 
> <?
> switch($x){ 
> case "frame": 
> ?>
>       <frameset framespacing="0" border="0" frameborder="NO" rows="135,*">
>       <frame name="top" src="header.shtml" marginwidth="0"
> marginheight="0" scrolling="NO" noresize>
>       <frame name="textarea" src="<? echo $url; ?>"> 
> <? 
> break; 
> } 
> ?>
> 
> Now one thing that I noticed is that often when the url is 
> encoded and I try
> the link, I get a 404 error. What am I doing wrong?
> 
> So the links that I hardcode into the html is something like
> xyz.com/frame.php?page=searchresults.php or something like that.
> 
> I'm really new to php so sorry if this is kinda vague. If there's a better
> way of doing what I'm trying to above, please let me know!
> 
> Thanks in advance for your help!
> __________________
> Jason Dulberg
> Extreme MTB
> http://extreme.nas.net
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to