Gossamer Forum
Home : General : Perl Programming :

framing search results

Quote Reply
framing search results
The guy that I do work for wants to be able to frame search results from realtor.com and mls.ca (realestate listings).

I'm using a script that some people from this forum helped me create. http://www.gossamer-threads.com/p/65251 The script works great but I've run into a problem when I try to frame search results by sites like the ones listed above.

When I try to frame the results, they lose a couple of the search terms which causes an error.

So if I do a search for
(please don't enter any MLS numbers into the contact form, its a live site)

http://www.hamiltonareahomes.com/...oronto&oid=30189

for instance, I get a couple errors. But if I remove the frameit.cgi part of the url (leaving just the realtor.com stuff), the search works fine.

Here's a snippet of the main part of my current script

use CGI qw(:standard);
my $page = param("page");
print "Content-type: text/html\n\n";
print qq!
#frame stuff
!;

So for some reason, the 2 scripts are interfering with eachother.

Is there a way to get around this or am I stuck?

Any input is greatly appreciated.



-----------
Jason Dulberg
Extreme MTB
http://extreme.nas.net
Quote Reply
Re: framing search results In reply to
Shouldn't the URL be

http://www.hamiltonareahomes.com/cgi-bin/frameit.cgi?page=http://www.realtor.com/iLead/ViewListings.asp\?mls=toronto\&oid=30189

the ? in the URL needs to be escaped otherwise it thinks the ? is defining a new variable (i.e. $FORM{mls} would be 'toronto'). This is also the case for the & part in the URL. You need to escape any $'s and &'s with a \ Cool

Hope this helps

Andy

http://www.ace-installer.com
webmaster@Ace-installer.com
Quote Reply
Re: framing search results In reply to
Thanks for your input.

I tried the method that you suggested, however it gave me a 404 error this time.



-----------
Jason Dulberg
Extreme MTB
http://extreme.nas.net
Quote Reply
Re: framing search results In reply to
You need to escape the ?, = and & in page= tag. So if the URL was:

http://www.hamiltonareahomes.com/cgi-bin/frameit.cgi?page=http% 3A% 2F% 2Fwww.realtor.com% 2FiLead% 2FViewListings.asp% 3Fmls% 3Dtoronto% 26oid% 3D30189

It works. To generate the URL encoded data, use CGI::escape() function. (Remove spaces after % sign, forum doesn't handle it properly).

my $encoded = CGI::escape ("http://www.realtor.com/iLead/ViewListings.asp?mls=toronto&oid=30189");

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: framing search results In reply to
Awesome... works.

Is there a way to use the escape function with the ?page= stuff? Since I will be framing a whole ton of pages, I can't put them all in the cgi script.

Can I do something like:

my $encoded = CGI::escape($page);

Thanks for your help!

-----------
Jason Dulberg
Extreme MTB
http://extreme.nas.net
Quote Reply
Re: framing search results In reply to
Thanks for your help Alex... I just tried the following which encodes the URL's but now I'm getting a 404 error.

Here's a snippet:

use CGI qw(:standard);
my $page = param("page");
my $encoded = CGI::escape($page);

<frame name="textarea" src="$encoded" marginwidth="0" marginheight="0">

Is there any way around this little glitch?

Thanks!

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