A working Perl script does not work when used on our new server???


The problem with perl files is that output of perl files have default content type header as text/html. Perl files that generate xml are outputting xml in the form of text.
what change we need to make to solve this?


we get the out put as below in the browser instead of showing xml file.
=============================
[Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Type: text/xml; charset=ISO-8859-1  ]
=======================================
Correct out put to find markers on map =

================================
 <markers>
  <results count="3" longitude="-75.953813333333" latitude="39.800456333333" />
  <marker i="0" lat="39.803396" lng="-75.955323" id="5486136" price="1,200.0" city="OXFORD" property_type="Commercial" beds="" baths="OneBath" address="247 REEDVILLE" ph="1" />
  <marker i="1" lat="39.800474" lng="-75.954889" id="5483128" price="375,000.0" city="OXFORD" property_type="Commercial" beds="" baths="" address="1895 BALTIMORE" ph="0" />
  <marker i="2" lat="39.797499" lng="-75.951228" id="5332915" price="1,900,000.0" city="OXFORD" property_type="Commercial" beds="" baths="" address="355 REEDVILLE" ph="10" />
  </markers>
======================================================

I have attached config file for Apache and perl.
 The same perl file on other server give output as  xml file.
we tired by adding "AddHandler send-as-is asis " to Apache conf we also enabled "mod_asis.so" module and restarted Apache server but it did not make any difference.

#!/usr/bin/perl
 
use CGI;
use Digest::MD5 qw(md5_hex);
use DBI;
 
my $dbh = DBI->connect ("DBI:mysql:xxx", 'xxxx', 'xxxx');
 
my $cgi = CGI->new();
 
my $sth = '';
 
my $USERID = '';
if ($cgi->cookie(-name=>'USERID'))
{
    $USERID = $cgi->cookie(-name=>'USERID');
}
else
{
    $USERID = md5_hex($cgi->remote_host().time());
    print "Set-Cookie: ",$cgi->cookie(-name=>'USERID',-value=>$USERID,-expires=>'+36M'),"\n";
}
 
my $SITEID = $cgi->param("siteid") || 'chris';
my $MLSID = $cgi->param("mlsid"); 
my $RADIUS = $cgi->param("radius");
my $LONGITUDE = $cgi->param("long");
my $LATITUDE = $cgi->param("lat");
my $ZOOMLEVEL = $cgi->param("zoom");
 
$RADIUS ||= 2;
 
my $mls_table = 'rets_listings';
 
 
$sth = $dbh->prepare("SELECT listingid as ML_Number FROM $mls_table WHERE listingid = ?");
$sth->execute($MLSID);
$MLSID = $sth->fetchrow;
 
unless ($MLSID)
{
    $sth = $dbh->prepare("SELECT listingid as ML_Number FROM $mls_table ORDER BY RAND() LIMIT 1");
    $sth->execute;
    $MLSID = $sth->fetchrow;
}
 
if ($MLSID && $RADIUS && !$ZOOMLEVEL)
{
    if ($RADIUS < 1) { $ZOOMLEVEL = 15; }
    elsif ($RADIUS < 3) { $ZOOMLEVEL = 14; }
    elsif ($RADIUS < 5) { $ZOOMLEVEL = 15; }
    elsif ($RADIUS < 10) { $ZOOMLEVEL = 12; }
    elsif ($RADIUS < 15) { $ZOOMLEVEL = 11; }
    elsif ($RADIUS < 30) { $ZOOMLEVEL = 9; }
    elsif ($RADIUS < 70) { $ZOOMLEVEL = 8; }
    elsif ($RADIUS < 160) { $ZOOMLEVEL = 7; }
    elsif ($RADIUS < 300) { $ZOOMLEVEL = 5; }
    elsif ($RADIUS < 500) { $ZOOMLEVEL = 3; }
    elsif ($RADIUS < 1000) { $ZOOMLEVEL = 1; }
}
 
$ZOOMLEVEL ||= 15;
 
my $BGCOLOR = $cgi->param("bgcolor") || 'FFFFFF';
my $NOADDRESS = $cgi->param("noaddress") || 'no';
my $MEVENT = $cgi->param("mevent") || 'click';
my $HEIGHT = $cgi->param("height") || 350;
my $IDX = $cgi->param("idx");
my $FLIDX = $cgi->param("flidx");
my $TARGET = $cgi->param("target") || '_blank';
 
my $PTYPE = 'RES';
 
if ($MLSID)
{
    $sth = $dbh->prepare("SELECT longitude,latitude,propertytype FROM $mls_table WHERE listingid = ?");
    $sth->execute($MLSID);
    ($LONGITUDE,$LATITUDE,$PTYPE) = $sth->fetchrow;
}
 
print $cgi->header;
 
print q~<html>
<head>
<title>Surrounding Properties</title>
<style type="text/css">
.text {font-size: 12px; font-family: Tahoma Arial Verdana;}
a.tab {font-weight: bolder; font-size: 14px; font-family: Tahoma Arial Verdana; text-decoration: none; color: black; }
a.subtab {font-weight: bolder; font-size: 12px; font-family: Tahoma Arial Verdana; text-decoration: none; color: black; }
a {font-size: 12px; font-family: Tahoma Arial Verdana; color: #3544FF; }
a.cookies {font-weight: bolder; font-size: 14px; font-family: Tahoma Arial Verdana; text-decoration: none; color: black; }
div.visible {width: 100%; height: 100%; display:block; }
div.notvisible {width: 100%; height: 100%; display:none; }
div.visible2 {width: 100%; height: 100%; display:block; }
div.notvisible2 {width: 100%; height: 100%; display:none; }
input.text {width: 180px;}
select {width: 180px;}
textarea {width: 280px;}
 
.divlayer {
 border: 3px solid #ff0000;
 z-index: 10000;
 height: 0px;
 width: 0px;
 left: 0px;
 top: 0px;
 margin: 0px;
 padding: 0px;
 position: absolute;
 line-height:0px;
 visibility:hidden;
}
body{margin:0;padding:0;}
table.imap-properties {
    padding: 2px;
    color: black;
    cursor: hand;
}
tr.imap-properties-title {
    background-color: #CCCCCC;
    font: bold 14px Tahoma Arial Verdana;
}
tr.imap-properties0 {
    background-color: #EEEEEE;
    font: 12px Tahoma Arial Verdana;
}
tr.imap-properties0:hover {
    background-color: #B0C5DB;
    font: 12px Tahoma Arial Verdana;
}
tr.imap-properties1 {
    background-color: #FFFFFF;
    font: 12px Tahoma Arial Verdana;
}
tr.imap-properties1:hover {
    background-color: #B0C5DB;
    font: 12px Tahoma Arial Verdana;
}
.disclaimer
{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: #CCCCCC;
}
.tooltip
{
	background-color: #FFFFFF;
	border: solid 2px #CCCCCC;
	padding: 2px;
	font: bold 11px Arial Tahoma Verdana;
	white-space: nowrap;
}
 
</style>
<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAGwodfPxOzVd5N5vYXpYaFRQTg9B9Qpb3NThO4hrIK47x8cQ8EhRR4-vp4mi8voyOejhuv9dJDiSBKg" type="text/javascript"></script>
<script>
var SITEID = '~.$SITEID.q~';
var USERID = '~.$USERID.q~';
var MLSID = '~.$MLSID.q~';
var RADIUS = ~.$RADIUS.q~;
var PTYPE = '~.$PTYPE.q~';
var LONGITUDE = ~.$LONGITUDE.q~;
var LATITUDE = ~.$LATITUDE.q~;
var ZOOMLEVEL = ~.$ZOOMLEVEL.q~;
var NOADDRESS = '~.$NOADDRESS.q~';
var MEVENT = '~.$MEVENT.q~';
var IDX = '~.$IDX.q~';
var TARGET = '~.$TARGET.q~';
</script>
<script language="JavaScript" src="/gsur.js"></script>
<script language="JavaScript" src="/js/overlibmws.js"></script>
</head>
<body style="margin:0;padding:0;" bgcolor="#~.$BGCOLOR.q~" onload="onLoad()">
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;font-size: 10px;"></div>
<div class="divlayer" id="ZoomLayer"></div>
<div align="center" class="text">
<h2>Surrounding Properties</h2>
<center>Adjust map radius in lower left.</center>
<h2>RESULTS</h2>
<p class="text">
This map shows properties for sale in the area surrounding the Feature Property.<br>
Only properties that could be located by their exact address are shown.<br>
</p>
</div>
 
<form method=POST name="radiusform">
<input type="hidden" name="siteid" value="~.$SITEID.q~">
<input type="hidden" name="userid" value="~.$USERID.q~">
<input type="hidden" name="mlsid" value="~.$MLSID.q~">
 
<table cellspacing=1 cellpadding=2 class=text bgcolor=white width="100%">
<tr>
<td align="center" width=25%>&nbsp;</td>
<td align="left">show sold properties <input type="checkbox" name="showSold" id="showSold" value="1" onclick="{ get_xml_data (); get_xml_data_list (); }"></td>
<td align="right">Adjust Map Width = </td><td width=20><select name="radius" style="width:50px;" onchange="document.radiusform.submit();">~;
for (1..50) { print qq{<option value="$_" }.($RADIUS == $_ ? 'selected':'').qq{>$_\n}; }
print q~</select></td><td width=60>mile radius</td></tr>
</table>
</form>
<table border=0 cellspacing=1 cellpadding=2 class=text bgcolor=white width="100%" height="~.$HEIGHT.q~">
<tr>
<td valign=top width=160>
<h3>Subject Property</h3>
~;
 
$sth = $dbh->prepare("SELECT * FROM $mls_table WHERE listingid = ?");
$sth->execute($MLSID);
my $hash = $sth->fetchrow_hashref;
 
while ($hash->{Listing_Price} =~ s/(\d)(\d{3})(\D|$)/$1,$2$3/) {}
 
print qq{
<table cellspacing=0 cellpadding=1 bgcolor=black>
<tr>
<td><img width=150 height=120 src="/mls_photos/$hash->{listingid}_01.jpg" onError="this.src= 'http://www.re-maps.com/nophoto150.jpg'"></td>
</tr>
</table>
<b>MLS\#</b> $hash->{listingid}<br>
<b>Price:</b> \$$hash->{listprice}<br>
};
 
print q~
</td>
<td bgcolor="#B0C5DB" valign=top>
<!-- START MAP -->
<DIV ID="loading" style="position:absolute;top:250px;left:300px;display:none;z-index:9999;">
<img src="/images/loading.gif" width="211" height="29" alt="LOADING MAP DATA ...">
</DIV>
<div id="map" style="WIDTH: 100%; HEIGHT: 100%;" class=visible></div>
<!-- END MAP -->
</td>
</tr>
</table>
<table cellspacing="1" cellpadding="1" width="100%">
<tr>
<td rowspan=2 valign=top width=160></td>
<td valign=top>
<div id="properties" style="overflow:auto; width:100%; height:100px"></div>
<div id="pcount"></div>
</td>
</tr>
<tr>
<td valign=top>
<div class="disclaimer">
Re-Data.com LLC and its clients assume no responsibility for any loss or 
impact resulting from the use of this information. No representation is made 
or warranty given to this information. This information is provided as a 
help in determining the location of listings but should not be relied on for 
any purchase decisions without first inspecting the listing in person or by 
a licensed inspector.
</div>
</td>
~;
print qq{<td valign=top><img src="$FLIDX"></td>} if ($FLIDX);
print q~
</tr>
</table>
<div align="center">
<table class="text" align="center" cellpadding=4>
<tr>
<td><img src="/images/pins.gif"></td><td><a class="cookies" href="http://www.re-maps.com/cookies.html" target="_blank"  onmouseover="return overlib('What are cookies? How to enable them? Click here for explanation!');" onmouseout="return nd();">Not seeing these icons? Please enable cookies in your browser.</a></td>
</tr>
</table>
</div>
<script language="JavaScript" src="/gmap_pan03.js"></script>
</body>
</html>
~;
 
 
$dbh->disconnect;

Open in new window

webguy62Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

webguy62Author Commented:
Here are the config files for servers
0
Adam314Commented:
The code you posted generates HTML, not the XML you posted.  

Is this related to this question: http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_24389835.html
0
Todd MummertCommented:

line 81:
print $cgi->header;


try

print $cgi->header( -type => 'text/xml' );
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

mrjoltcolaCommented:
I am confused by your question, because as Adam pointed out, the script does not generate XML, but even so, why don't you explicitly set the content type in the response?

Use the header() method of the CGI module

$q->header('text/xml');

or rather than text/xml, if your XML is well known standard application specific format, such as rss, use the application/rss+xml, etc.
0
webguy62Author Commented:
HI Guys thanks for responses and your Patience.. I am sorry if I am not explaining this correcty as I am not a perl programmer. All other perl scripts work fine on new server.

  Responses in order below:


RE: Adam314:The code you posted generates HTML, not the XML you posted.  
Is this related to this question: http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_24389835.html 

(YES.. the solution never worked, I was told by someone here that it wopudl work it then responded as such but it did not and we have been struggling for a couple weeks trying everything) All new sites are done in PHP . Our Perl guy left so we are bumbling our way through PERL :)
++++++++++++++++++++++++++++++++++++++++++++++
RE:climbgunks:
line 81:
print $cgi->header;

try
print $cgi->header( -type => 'text/xml' );

we did as suggested and got error= The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

A semi colon character was expected. Error processing resource 'http://www.simplechoicerealty.com/gsur.pl?mlsid=5512360'. ...

<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAGwodfPxOzVd5N5vYXpYaFRQTg9B9Qpb3NThO4hrIK47x8...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
RE:I am confused by your question, because as Adam pointed out, the script does not generate XML, but even so, why don't you explicitly set the content type in the response?  
Use the header() method of the CGI module

$q->header('text/xml');

or rather than text/xml, if your XML is well known standard application specific format, such as rss, use the application/rss+xml, etc.  we tried this on line 81 and also did not work


 what this script does and does well is show surrounding properties on a google map using xml output. It works on 3 dozen websites. But when migrating an old site to a new server that script will not do the same thing as it does on old server,. It adds a new few lines at top  instead of showing ,markers?



0
Adam314Commented:
About post 24476655 (climbjunks): You don't want to change the header for this page, as this page is HTML.  
About post 24476694 (mrjoltcola): This code is how you would tell the browser that the page is XML (instead of HTML), but this needs to be put in the correct file - which is not the file you've posted.


In the related question, it appears that the XML is actually generated by index.php, and your apache config redirects to the index.php when you request the above page.  Is this the case?  If so, you need to make the change in index.php.  And since it is a php file (not perl), you need to use php code to display the header (not the perl code above), which would be:
    header('Content-type: text/xml');


If your server is setup differently than in your other question, you'll have to let us know how it is setup.  If using apache, you could attach your httd.conf or apache2.conf files.  
0
mrjoltcolaCommented:
>>we did as suggested and got error= The XML page cannot be displayed
>>Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

You got this error from a browser? I am still not clear on why you call this CGI directly from a browser if it returns XML content in the format you give? I assume you are using the CGI to generate an XML file that is used by another program to display output. If not, I am unfamilar with how you are displaying markers using this format. I have implemented Google maps before, but looking at your code, I still cannot see where you are generating XML so I am at a loss.





0
mrjoltcolaCommented:
Ok, I see now. We are looking at the wrong file. I will leave the thread now, as Adam seems to have grasped the issue already.
0
Adam314Commented:
mrjoltcola - If you look through the other question (that I linked to in my first post), you may get some helpful background info.  As I helped in that other question, I already had that background.  
0
webguy62Author Commented:
the files requested
config.zip
0
webguy62Author Commented:
I wil try to explain differently.  The gsur.pl is supposed to pull similar geocoded properties from database and   display on a google map as on this demo site: http://carr.re-data.org/?pageid=mls&ML_Number=5408500  and page = http://carr.re-data.org/gsur.pl?mlsid=5408500 ( old server). On new server..see screen shot
new-server.jpg
0
webguy62Author Commented:
screen shot of new server
correct-map.jpg
0
Adam314Commented:
I'm not familiar with what you need to send to google to have it display correctly.  I can only help with the XML part.

What are the URLs (old server/new server) you enter to get to the XML?
0
webguy62Author Commented:
old server

  http://carr.re-data.org/mls.html?&search=yes&srch=1&la=Albany+Twp&price1=300000&price2=500000&customType=Single&county=Berks
  click surrounding properties button of any listing with an address to see  a page like this

http://carr.re-data.org/gsur.pl?mlsid=5408500
login = test12@test.com
==========================
new server

http://www.simplechoicerealty.com/mls.html?ML_Number=5494900&page=0  then click to see surrounding propertiers to see url http://www.simplechoicerealty.com/surrounding_properties.html?mlsid=5494900

login= support@re-data.com


thanks again
0
mrjoltcolaCommented:
When I access the old site URL under Firebug, I see the data request to gdata.pl
It is gdata.pl that generates the XML, not gcur.pl

However, running the new site URL I see no call to gdata.pl, and the URL itself is PHP I guess, I cannot see due to the URL naming.

So, unless I am missing something, your main page HTML output does not include any code to call gdata.pl, or the PHP code is calling it on the server side.
0
mrjoltcolaCommented:
With the latest link I do see the call to gdata. pl, not sure what the difference was. And I see the issue now.
0
webguy62Author Commented:
this is the gdata.pl script.    Hope it helps

  I will  pass this info on to the php guys.  They can make more sense of it than I can ;)
=====================
#!/usr/bin/perl

$| = 1;

my $debug = 1;

open (LOG, '>./debug/gdata.pl.log') if ($debug);
print LOG '-'x79,"\n" if ($debug);

use DBI;
use CGI;
use Geo::Distance;
my $geo = new Geo::Distance;
 
my $cgi = CGI->new();

my $dbh = DBI->connect ("DBI:mysql:cccccccc", 'ccccccccc', 'ccccccccc');

my $SITEID = $cgi->cookie(-name=>'SITEID') || $cgi->param("siteid") || 'chrisredata';
my $USERID = $cgi->cookie(-name=>'USERID') || $cgi->param("userid");

if($cgi->param("sold") == 2 &&  $cgi->param("id"))
{
print "Content-Type: text/xml; charset=ISO-8859-1\n\n";
 print qq{<markers>
<results count="50" longitude="-75.4266122" latitude="39.82734888"/>
<marker i="100" lat="39.829680" lng="-75.426835" id="5424452" price="127,500.0" city="BOOTHWYN" property_type="Residential" beds="3" baths="" address="1901 HUDDLE" ph="sold"/>
<marker i="101" lat="39.826033" lng="-75.426441" id="5422337" price="99,000.0" city="LINWOOD" property_type="Residential" beds="2" baths="" address="4 MAISE" ph="sold"/>
<marker i="102" lat="39.829198" lng="-75.427499" id="5418570" price="83,800.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="523 JOHNSON" ph="sold"/>
<marker i="103" lat="39.825949" lng="-75.426030" id="5393563" price="133,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="3 MAISE" ph="sold"/>
<marker i="104" lat="39.828440" lng="-75.428633" id="5374821" price="119,000.0" city="BOOTHWYN" property_type="Residential" beds="2" baths="" address="622 TAYLOR" ph="sold"/>
<marker i="105" lat="39.829310" lng="-75.426656" id="5368868" price="60,000.0" city="MARCUS HOOK" property_type="Residential" beds="2" baths="" address="1827 HUDDLE" ph="sold"/>
<marker i="106" lat="39.827050" lng="-75.423729" id="5304469" price="72,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1639 WARD" ph="sold"/>
<marker i="107" lat="39.828521" lng="-75.429830" id="5290171" price="75,000.0" city="LINWOOD" property_type="Residential" beds="2" baths="" address="713 JOHNSON" ph="sold"/>
<marker i="108" lat="39.827178" lng="-75.425716" id="5290079" price="97,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1632 HUDDLE" ph="sold"/>
<marker i="109" lat="39.829680" lng="-75.426835" id="5285501" price="80,000.0" city="MARCUS HOOK" property_type="Residential" beds="3" baths="" address="1901 HUDDLE" ph="sold"/>
<marker i="110" lat="39.827838" lng="-75.424232" id="5237237" price="159,000.0" city="LINWOOD" property_type="Residential" beds="4" baths="" address="1675 WARD" ph="sold"/>
<marker i="111" lat="39.828080" lng="-75.429714" id="5226167" price="67,000.0" city="MARCUS HOOK" property_type="Residential" beds="4" baths="" address="1817 CHICHESTER" ph="sold"/>
<marker i="112" lat="39.825445" lng="-75.426310" id="5173045" price="129,900.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="138 EDWARD" ph="sold"/>
<marker i="113" lat="39.824855" lng="-75.426637" id="5111341" price="114,000.0" city="LINWOOD" property_type="Residential" beds="2" baths="" address="147 EDWARD" ph="sold"/>
<marker i="114" lat="39.828403" lng="-75.428764" id="5060917" price="119,000.0" city="BOOTHWYN" property_type="Residential" beds="2" baths="" address="626 TAYLOR" ph="sold"/>

<marker i="115" lat="39.829002" lng="-75.424865" id="5028921" price="158,000.0" city="BOOTHWYN" property_type="Residential" beds="3" baths="" address="33 TAYLOR" ph="sold"/>
<marker i="116" lat="39.828125" lng="-75.427903" id="5000413" price="119,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="609 TAYLOR" ph="sold"/>
<marker i="117" lat="39.829922" lng="-75.427081" id="4983289" price="15,000.0" city="BOOTHWYN" property_type="Lot-Land" beds="" baths="" address="1930 HUDDLE" ph="sold"/>
<marker i="118" lat="39.827247" lng="-75.425749" id="4971428" price="145,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1638 HUDDLE" ph="sold"/>
<marker i="119" lat="39.825397" lng="-75.424580" id="4969980" price="100,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1549 HUDDLE" ph="sold"/>
<marker i="120" lat="39.827396" lng="-75.426132" id="4939742" price="129,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1630 HUDDELL" ph="sold"/>
<marker i="121" lat="39.824543" lng="-75.425279" id="4915026" price="102,900.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1529 BEALE" ph="sold"/>
<marker i="122" lat="39.828736" lng="-75.427639" id="4903050" price="125,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="526 TAYLOR" ph="sold"/>
<marker i="123" lat="39.826654" lng="-75.426995" id="4899206" price="135,000.0" city="LINWOOD" property_type="Residential" beds="4" baths="" address="1640 CHICHESTER" ph="sold"/>
<marker i="124" lat="39.829280" lng="-75.426642" id="4890758" price="96,900.0" city="MARCUS HOOK" property_type="Residential" beds="3" baths="" address="1821 HUDDLE" ph="sold"/>
<marker i="125" lat="39.828191" lng="-75.430035" id="4882934" price="118,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1825 CHICHESTER" ph="sold"/>
<marker i="126" lat="39.827335" lng="-75.424735" id="4850616" price="134,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1646 WARD" ph="sold"/>
<marker i="127" lat="39.827259" lng="-75.427627" id="4837926" price="199,990.0" city="LINWOOD" property_type="Multi-Family" beds="" baths="" address="1659 CHICHESTER" ph="sold"/>
<marker i="128" lat="39.828101" lng="-75.427980" id="4831384" price="126,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="611 TAYLOR" ph="sold"/>
<marker i="129" lat="39.829235" lng="-75.425910" id="4829189" price="145,000.0" city="BOOTHWYN" property_type="Residential" beds="3" baths="" address="304 TAYLOR" ph="sold"/>
<marker i="130" lat="39.825276" lng="-75.424543" id="4822882" price="164,000.0" city="LINWOOD" property_type="Residential" beds="4" baths="" address="1544 HUDDLE" ph="sold"/>
<marker i="131" lat="39.825382" lng="-75.425351" id="4811902" price="139,900.0" city="LINWOOD" property_type="Residential" beds="2" baths="" address="117 EDWARD" ph="sold"/>
<marker i="132" lat="39.824690" lng="-75.425861" id="4789622" price="42,500.0" city="LINWOOD" property_type="Residential" beds="2" baths="" address="1546 BEALE" ph="sold"/>
<marker i="133" lat="39.826854" lng="-75.424478" id="4777747" price="190,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1628 WARD" ph="sold"/>
<marker i="134" lat="39.825764" lng="-75.424089" id="4777522" price="169,500.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1570 CHICHESTER" ph="sold"/>
<marker i="135" lat="39.828380" lng="-75.428827" id="4755658" price="100,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="628 TAYLOR" ph="sold"/>
<marker i="136" lat="39.826651" lng="-75.427213" id="4710782" price="99,900.0" city="LINWOOD" property_type="Residential" beds="2" baths="" address="110 JONES" ph="sold"/>
<marker i="137" lat="39.824462" lng="-75.426764" id="4703663" price="118,000.0" city="MARCUS HOOK" property_type="Residential" beds="2" baths="" address="1556 WEBER" ph="sold"/>
<marker i="138" lat="39.825353" lng="-75.425564" id="4703358" price="124,900.0" city="LINWOOD" property_type="Residential" beds="2" baths="" address="119 EDWARD" ph="sold"/>
<marker i="139" lat="39.825488" lng="-75.424690" id="4691079" price="90,000.0" city="MARCUS HOOK" property_type="Residential" beds="3" baths="" address="1552 HUDDLE" ph="sold"/>
<marker i="140" lat="39.828317" lng="-75.429046" id="4685658" price="110,000.0" city="BOOTHWYN" property_type="Residential" beds="3" baths="" address="634 TAYLOR" ph="sold"/>
<marker i="141" lat="39.829235" lng="-75.425910" id="4671010" price="74,900.0" city="LINWOOD" property_type="Residential" beds="2" baths="" address="304 TAYLOR" ph="sold"/>
<marker i="142" lat="39.826348" lng="-75.427046" id="4666977" price="82,000.0" city="BOOTHWYN" property_type="Residential" beds="2" baths="" address="119 JONES" ph="sold"/>
<marker i="143" lat="39.829901" lng="-75.427026" id="4664742" price="85,000.0" city="MARCUS HOOK" property_type="Residential" beds="2" baths="" address="1927 HUDDLE" ph="sold"/>
<marker i="144" lat="39.827921" lng="-75.426712" id="4663893" price="129,900.0" city="BOOTHWYN" property_type="Residential" beds="3" baths="" address="512 LAUGHEAD" ph="sold"/>
<marker i="145" lat="39.828599" lng="-75.429568" id="4657705" price="91,000.0" city="BOOTHWYN" property_type="Residential" beds="2" baths="" address="707 JOHNSON" ph="sold"/>
<marker i="146" lat="39.825713" lng="-75.426545" id="4622473" price="105,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="9 MAISE" ph="sold"/>
<marker i="147" lat="39.827082" lng="-75.424182" id="4592423" price="93,000.0" city="LINWOOD" property_type="Residential" beds="3" baths="" address="1647 WARD" ph="sold"/>
<marker i="148" lat="39.825797" lng="-75.426359" id="4579186" price="109,900.0" city="MARCUS HOOK" property_type="Residential" beds="2" baths="" address="7 MAISE" ph="sold"/>

<marker i="149" lat="39.828148" lng="-75.427823" id="4575616" price="119,000.0" city="BOOTHWYN" property_type="Residential" beds="3" baths="" address="607 TAYLOR" ph="sold"/>
</markers>};

exit;

}

my $sold_flag;
my $mls_table = 'rets_listings';

$mls_table = 'rets_all_sold' if($cgi->param("sold") == 1);

$sold_flag = 1 if($cgi->param("sold") == 1);

if($cgi->param("id"))
{
   $sth = $dbh->prepare("SELECT count(*) FROM rets_listings WHERE listingid  = ?");
    $sth->execute($cgi->param("id"));
    my $cnt = $sth->fetchrow;
 
if($cnt <= 0) {
$mls_table = 'rets_all_sold';
$sold_flag =1;
} else {
$mls_table = 'rets_listings';
$sold_flag =0;

}
}


my $sth;

my @markers = ();
my @sid = ();

if ($USERID && !$cgi->param("id"))
{
    $sth = $dbh->prepare("SELECT markers FROM google_markers WHERE siteid = ? AND userid = ?");
    $sth->execute($SITEID, $USERID);
    my $markers = $sth->fetchrow;
    @markers = split(/\n/,$markers);
    for (my $i = 0; $i < @markers; $i ++)
    {
      my ($row_i,$row_lat,$row_long,$row_id,$row_price,$row_city,$row_ptype,$row_beds,$rows_baths,$row_address,$row_ph) = split(/\|/,$markers[$i]);

      if ($cgi->param("minx") <= $row_long && $row_long <= $cgi->param("maxx") &&
      $cgi->param("miny") <= $row_lat && $row_lat <= $cgi->param("maxy"))
      {
          push (@sid, $row_id);
      }
      else
      {
          $markers[$i] = '';
      }
    }
}

#print "Cache-Control: no-store, no-cache, must-revalidate\n\n";
print "Pragma: no-cache\n";
print "Content-Type: text/xml; charset=ISO-8859-1\n\n";
#print "Content-Type: text/html; charset=ISO-8859-1\n\n";
#print  '<?xml version="1.0" encoding="ISO-8859-1"?>';



my @v = ();
my $q = '';

if ($cgi->param("search") eq 'yes')
{
    @markers = ();
    @sid = ();

    $sth = $dbh->prepare("DELETE FROM google_markers WHERE siteid = ? AND userid = ?");
    $sth->execute($SITEID, $USERID);

#    $sth = $dbh->prepare("DELETE FROM mls_flashmap WHERE User_Id = ?");
#    $sth->execute($USERID);
}
else
{
 #   $sth = $dbh->prepare("SELECT ML_Number FROM mls_flashmap WHERE User_Id = ?");
 #   $sth->execute($USERID);
   my @m = ();
 #   while (my $mid = $sth->fetchrow)
 #   {
#      push (@m, $mid);
#    }
    if (@m)
    {
      $q .= " AND ML_Number IN ('".join("','",@m)."') ";
    }
}

if ($cgi->param("id")){$q.=' AND listingid = ? ';push(@v,$cgi->param("id"));}

 if($sold_flag != 1 )
{
if ($cgi->param("minx")){$q.=' AND longitude >= CAST(? as SIGNED)  ';push(@v,$cgi->param("minx"));}
if ($cgi->param("maxx")){$q.=' AND longitude <= CAST(? as SIGNED) ';push(@v,$cgi->param("maxx"));}
if ($cgi->param("miny")){$q.=' AND latitude >= CAST(? as SIGNED) ';push(@v,$cgi->param("miny"));}
if ($cgi->param("maxy")){$q.=' AND latitude <= CAST(? as SIGNED) ';push(@v,$cgi->param("maxy"));}

if ($cgi->param("mlsid")){$q.=' AND listingid = ? ';push(@v,$cgi->param("mlsid"));}
if ($cgi->param("from_price")){$q.=' AND listprice >= CAST(? as SIGNED) ';push(@v,$cgi->param("from_price"));}
if ($cgi->param("to_price")){$q.=' AND listprice <= CAST(? as SIGNED) ';push(@v,$cgi->param("to_price"));}
if ($cgi->param("beds")){$q.=' AND beds >= CAST(? as SIGNED) ';push(@v,$cgi->param("beds"));}
if ($cgi->param("baths")){$q.=' AND Baths >= CAST(? as SIGNED) ';push(@v,$cgi->param("baths"));}
if ($cgi->param("street")){$q.=' AND  streetname = ? ';push(@v,$cgi->param("street"));}
if ($cgi->param("city")){$q.=' AND cityname = ? ';push(@v,$cgi->param("city"));}
if ($cgi->param("zip")){$q.=' AND postalcode = ? ';push(@v,$cgi->param("zip"));}

if ($cgi->param("ptype") =~ /all/i) { $cgi->param("property_type",""); }
elsif ($cgi->param("ptype")) { $cgi->param("property_type",uc($cgi->param("ptype"))); }

if ($cgi->param("property_type")){$q.=' AND propertytype = ? '; push(@v,$cgi->param("property_type")); }
 }
my %distance = ();
if ($cgi->param("surid"))
{
    my $radius = $cgi->param("radius") || 2;
   
    $sth = $dbh->prepare("SELECT longitude,latitude FROM rets_listings WHERE listingid  = ?");
    $sth->execute($cgi->param("surid"));
    my ($lon1, $lat1) = $sth->fetchrow;

      $sth = $dbh->prepare("SELECT * FROM $mls_table WHERE ((ABS(?-`longitude`) + ABS(?-`latitude`)) > 0 OR listingid = ?) ORDER BY  (ABS(?-`longitude`) + ABS(?-`latitude`)) LIMIT 100");

      #$sth = $dbh->prepare("SELECT listingid as id,longitude as lng,latitude as lat,listprice as price,cityname as city,propertytype as property_type,beds as beds,bathrooms as baths,CONCAT(streetnumber,' ',streetname) as address, postalcode as zip, remarks as remarks,CONCAT('/mls.html?ML_Number=',listingid) as details,totalphotos as photocount,listingid as primary_photo FROM $mls_table WHERE WHERE ((ABS(?-`longitude`) + ABS(?-`latitude`)) > 0 OR listingid = ?) ORDER BY  (ABS(?-`longitude`) + ABS(?-`latitude`)) LIMIT 100") if($sold_flag != 1);
      #$sth = $dbh->prepare("SELECT listingid as id,longitude as lng,latitude as lat,closeprice as price,cityname as city,propertytype as property_type,beds as beds,bathrooms as baths,CONCAT(streetnumber,' ',streetname) as address, postalcode as zip,CONCAT('/mls.html?ML_Number=',listingid) as details,totalphotos as photocount,listingid as primary_photo FROM $mls_table WHERE WHERE ((ABS(?-`longitude`) + ABS(?-`latitude`)) > 0 OR listingid = ?) ORDER BY  (ABS(?-`longitude`) + ABS(?-`latitude`)) LIMIT 100") if($sold_flag == 1);

      #print "SELECT * FROM $mls_table WHERE ((ABS(?-`longitude`) + ABS(?-`latitude`)) > 0 OR listingid = ?) ORDER BY  (ABS(?-`longitude`) + ABS(?-`latitude`)) LIMIT 100";
       #print "\n\n$lon1, $lat1, ".$cgi->param("surid").", $lon1, $lat1";
      #exit;

    $sth->execute($lon1, $lat1, $cgi->param("surid"), $lon1, $lat1);


    while (my $hash = $sth->fetchrow_hashref)
    {
      #print $hash->{listingid}." -  ".$geo->distance( 'mile', $lon1,$lat1 => $hash->{longitude},$hash->{latitude} )."<br>";
      $distance{$hash->{listingid}} = $geo->distance( 'mile', $lon1,$lat1 => $hash->{longitude},$hash->{latitude} );
      #$info{$hash->{listingid}} = $hash;
    }
#exit;

    my @distance = ();
    my $i = 0;
    foreach my $spid (sort {$distance{$a} <=> $distance{$b}} (keys %distance))
    {
      $i++;
#      last if ($i > 50 || ($distance{$spid} > $radius));
      last if ($i > 5 || ($distance{$spid} > $radius));

      push (@distance, $spid);
    }

    $q .= " AND listingid  IN ('".join("','",@distance)."')";
}

if (@sid){$q.= " AND listingid  NOT IN ('".join("','",@sid)."')";}

print "<markers>\n";

#my $query = "SELECT COUNT(listingid ) FROM $mls_table WHERE abs(longitude + 0) > 1 and abs(latitude + 0) > 1 $q";
#$sth = $dbh->prepare($query);
#$sth->execute(@v);
#my $count = $sth->fetchrow+0;
 

print LOG $count,"\n" if ($debug);

#$query = "SELECT longitude as longitude, latitude as latitude FROM $mls_table WHERE abs(longitude + 0) > 1 and abs(latitude + 0) > 1 $q LIMIT 1";
$query = "SELECT AVG(longitude) as longitude, AVG(latitude) as latitude,COUNT(listingid ) FROM $mls_table WHERE abs(longitude + 0) > 1 and abs(latitude + 0) > 1 $q";
$sth = $dbh->prepare($query);
$sth->execute(@v);
my ($newlong,$newlat,$count) = $sth->fetchrow;

print LOG "($newlong,$newlat)\n" if ($debug);

print qq{<results count="$count" longitude="$newlong" latitude="$newlat"/>\n};

$query = "SELECT listingid as id,longitude as lng,latitude as lat,listprice as price,cityname as city,propertytype as property_type,beds as beds,bathrooms as baths,CONCAT(streetnumber,' ',streetname) as address, postalcode as zip, remarks as remarks,CONCAT('/mls.html?ML_Number=',listingid) as details,totalphotos as photocount,listingid as primary_photo FROM $mls_table WHERE abs(longitude + 0) > 1 and abs(latitude + 0) > 1 $q ORDER BY listingid DESC LIMIT 50" if($sold_flag != 1);
$query = "SELECT listingid as id,longitude as lng,latitude as lat,closeprice as price,cityname as city,propertytype as property_type,beds as beds,bathrooms as baths,CONCAT(streetnumber,' ',streetname) as address, postalcode as zip,CONCAT('/mls.html?ML_Number=',listingid) as details,totalphotos as photocount,listingid as primary_photo FROM $mls_table WHERE abs(longitude + 0) > 1 and abs(latitude + 0) > 1 $q ORDER BY listingid DESC LIMIT 50" if($sold_flag == 1);

print LOG $query,"\n" if ($debug);

print LOG join('|',@v),"\n" if ($debug);

$sth = $dbh->prepare($query);
$sth->execute(@v);

my $i = 0;
$i = 100 if($sold_flag == 1);
my @data = ();


while (my $hash = $sth->fetchrow_hashref)
{
    while ($hash->{price} =~ s/(\d)(\d{3})(\D|$)/$1,$2$3/) {}

    $hash->{remarks} =~ s/\&/and/gsi;
    $hash->{address} =~ s/\&/and/gsi;

    my $info = substr($hash->{remarks},0,100);
    $info =~ s/(\w+)$//si;
   # $info .= '...';
   #  my $info = $hash->{remarks};
#    $info ="";
    if (!$hash->{PrimaryPhoto})
      {
         # $hash->{PrimaryPhoto} = "/images/nophoto150.jpg";
         # $hash->{photocount} = 0;
          $hash->{PrimaryPhoto} = '/mls_photos/'.$hash->{id}.'_01.jpg';
      }
    elsif (!(-s "mls_photos/$hash->{PrimaryPhoto}"))
      {
          $hash->{PrimaryPhoto} = "/images/nophoto150.jpg";
          $hash->{photocount} = 0;
      }
    else
      {
          $hash->{PrimaryPhoto} = '/mls_photos/'.$hash->{PrimaryPhoto};
      }
    if ($cgi->param("id"))
    {
      if($sold_flag == 1)
      {
        print qq{<marker i="$i" lat="$hash->{lat}" lng="$hash->{lng}" id="$hash->{id}" price="$hash->{price}" city="$hash->{city}" property_type="$hash->{property_type}" zip="$hash->{zip}" beds="$hash->{beds}" baths="$hash->{baths}" address="$hash->{address}" photo="$hash->{PrimaryPhoto}" details="$hash->{details}" info="$info" ph="sold"/>\n};
      } else {
        print qq{<marker i="$i" lat="$hash->{lat}" lng="$hash->{lng}" id="$hash->{id}" price="$hash->{price}" city="$hash->{city}" property_type="$hash->{property_type}" zip="$hash->{zip}" beds="$hash->{beds}" baths="$hash->{baths}" address="$hash->{address}" photo="$hash->{PrimaryPhoto}" details="$hash->{details}" info="$info" ph="$hash->{photocount}"/>\n};
      }

    }
    else
    {
      if($sold_flag == 1)
      {
      push (@data, "$i|$hash->{lat}|$hash->{lng}|$hash->{id}|$hash->{price}|$hash->{city}|$hash->{property_type}|$hash->{beds}|$hash->{baths}|$hash->{address}|sold");
      } else {
      push (@data, "$i|$hash->{lat}|$hash->{lng}|$hash->{id}|$hash->{price}|$hash->{city}|$hash->{property_type}|$hash->{beds}|$hash->{baths}|$hash->{address}|$hash->{photocount}");
      }


    }
    $i ++;
}
if ($USERID && !$cgi->param("id") )      
{
    print LOG "ok\n" if ($debug);
#    print LOG max($#markers+1,$#data+1) ,"\n" if ($debug);
    my $j = 0;
#    for (my $i = 0; $i < max($#markers+1,$#data+1); $i ++)
   for (my $i = 0; $i < $#data+1; $i ++)
    {
      unless ($markers[$i])
      {
          my ($row_i,$row_lat,$row_long,$row_id,$row_price,$row_city,$row_ptype,$row_beds,$row_baths,$row_address,$row_ph) = split(/\|/,$data[$j]);
                print qq{<marker i="$i" lat="$row_lat" lng="$row_long" id="$row_id" price="$row_price" city="$row_city" property_type="$row_ptype" beds="$row_beds" baths="$row_baths" address="$row_address" ph="$row_ph"/>\n} if ($row_id);
             $markers[$i] = "$i|$row_lat|$row_long|$row_id|$row_price|$row_city|$row_ptype|$row_beds|$row_baths|$row_address|$row_ph";
          $j++;
      }
    }
    $sth = $dbh->prepare("REPLACE INTO google_markers (siteid,userid,markers,minx,miny,maxx,maxy) VALUES (?,?,?,?,?,?,?)");
    $sth->execute($SITEID,$USERID.'', join("\n",@markers).'', $cgi->param("minx").'', $cgi->param("miny").'',$cgi->param("maxx").'',$cgi->param("maxy").'');
}
$sth->finish;

print "</markers>\n";

$dbh->disconnect;

close (LOG) if ($debug);
 
exit;

sub max ()
{
    return $_[0] > $_[1] ? $_[0] : $_[1];
}

0
mrjoltcolaCommented:
The correct headers themselves are being printed as part of the body of the output. The gdata.pl results DO have XML in them, but they also have the wrong content-type, and the

Pragma: no-cache
Content-Type: text/xml; charset=ISO-8859-1

which should be part of the header is actually part of the content.

You have not posted the source to gdata.pl so I cannot tell. I think that is the critical file to look at.
0
mrjoltcolaCommented:
Next time use the code snippet window, it will help.

Also, I never did see the apache config for either site. Did I miss it?

Are you running this under mod_perl or a straight CGI?
0
mrjoltcolaCommented:
I do not think it is the script itself, it must be the Apache config. Please post the old and new configs (as attachments or snippet window)
No need to post the whole thing if you think you know the appropriate config sections, or if it is sensitive, you can email them offline and we can add the appropriate snippet to the final solution.
0
webguy62Author Commented:
not being a perl programmer ..my guess is that we need to comment the uncommentdd lines in below? OR


 #print "Cache-Control: no-store, no-cache, must-revalidate\n\n";
print "Pragma: no-cache\n";
print "Content-Type: text/xml; charset=ISO-8859-1\n\n";
#print "Content-Type: text/html; charset=ISO-8859-1\n\n";
#print  '<?xml version="1.0" encoding="ISO-8859-1"?>';
0
mrjoltcolaCommented:
Since the data is being parsed by Javascript, I doubt it matters what the header info is, as long as the XML content is there in the response as expected, with no interfering headers, so your idea is likely a good one. Try it.
0
mrjoltcolaCommented:
The root problem is the AJAX call to gdata.pl is expecting an HTTP response:

Pragma: no-cache
Content-Type: text/xml; charset=ISO-8859-1

<markers>
...
</markers>


But what it is getting is the following. Something is treating the output of the gdata.pl as script output and taking care of the headers. Likely it is mod_perl / Apache.

Content-Type: text/plain    <-- This part is parsed/filtered by the browser, the rest is passed on

Pragma: no-cache               <-- This part SHOULD have been parsed by the browser, if it was not for the header above and the empty line
Content-Type: text/xml; charset=ISO-8859-1          <-- so instead it is passed on as the content body

<markers>
...
</markers>
0
webguy62Author Commented:
if this will help I can say that we do have Mod PERL on old server but not installed n new sever? Could that be the cuprit?



0
webguy62Author Commented:
RE: Also, I never did see the apache config for either site. Did I miss it?   here  is config http://filedb.experts-exchange.com/incoming/2009/05_w22/142919/config.zip

the new server has the neweest apache version whcih we were thinking might have something to do this this but in looking at this site http://httpd.apache.org/docs/2.2/upgrading.html   I did not see anything but then again...

what is email addy?
0
mrjoltcolaCommented:
Your old working config have disabled mod_mime_magic, you can probably do without it. It could be a culprit, i am not too familiar with it.
Your new config has disabled .cgi and .pl as cgi-script for one. I would add that back. Also re-enable send-as-is

I would change the lines like so
#LoadModule mime_magic_module modules/mod_mime_magic.so
 
 
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl
 
#
# For files that include their own HTTP headers:
#
AddHandler send-as-is asis

Open in new window

0
webguy62Author Commented:
Thanks   will try all and get back on the morrow. Thanks for help

webdev@gmail.com
0
yfastudCommented:
3 things you need to check on your new server
1. make sure your shebang line point to correct perl installation dir
2. already enable php extensions php_xsl and php_xmlrpc
3. setup httpd.conf to run perl script; you can check this guide, and even it's for wampserver, but just to get the idea how to setup perl in httpd.conf
http://blog.jlbn.net/?p=42
http://blog.jlbn.net/?p=44
0
webguy62Author Commented:
good day all..

OK we tried everything mentioned yesterday and it did not work :(

re: 3 things you need to check on your new server
1. make sure your shebang line point to correct perl installation dir    (YES it is)
2. already enable php extensions php_xsl and php_xmlrpc  (YES)
3. setup httpd.conf to run perl script; you can check this guide, and even it's for wampserver, but just to get the idea how to setup perl in httpd.conf    Will confirm  ... thnx
http://blog.jlbn.net/?p=42
http://blog.jlbn.net/?p=44
0
mrjoltcolaCommented:
http://www.simplechoicerealty.com/gdata.pl?siteid=chris&userid=a72d3cca7a8dbf35c79c0414e36b25c9&search=yes&surid=5494900&radius=2&ptype=Residential

Returns the following HTTP headers:

 Date: Wed, 27 May 2009 15:48:58 GMT
 Server: Apache/2.2.3 (CentOS)
 Connection: close
 Transfer-Encoding: chunked
 Content-Type: text/plain


and the content in the snippet window below.

You still have, apparently, the print statement in your CGI for the content-type. Comment it out and try again.

Content-Type: text/xml; charset=ISO-8859-1
 
<markers>
<results count="5" longitude="-75.6055402" latitude="39.9172668"/>
<marker i="0" lat="39.916752" lng="-75.603636" id="5530696" price="674,900.0" city="WEST CHESTER" property_type="Residential" beds="4" baths="" address="1040 LITTLE RIDGE" ph="12"/>
<marker i="1" lat="39.921965" lng="-75.611748" id="5516722" price="585,000.0" city="WEST CHESTER" property_type="Residential" beds="4" baths="" address="1047 COUNTRY CLUB" ph="12"/>
<marker i="2" lat="39.912890" lng="-75.603612" id="5514806" price="669,900.0" city="WEST CHESTER" property_type="Residential" beds="4" baths="" address="1002 SABER" ph="12"/>
<marker i="3" lat="39.917580" lng="-75.603868" id="5494900" price="700,000.0" city="WEST CHESTER" property_type="Residential" beds="5" baths="" address="1052 CEDAR MILL" ph="12"/>
<marker i="4" lat="39.917147" lng="-75.604837" id="5482705" price="629,900.0" city="WEST CHESTER" property_type="Residential" beds="4" baths="" address="1001 CEDAR MILL" ph="12"/>
</markers>

Open in new window

0
Adam314Commented:
Try this simple test script.  Does it work as it should?  If not, then the problem is definetly in your apache config.
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
 
my $cgi = CGI->new;
print $cgi->header('text/xml');
print qq{<markers>
<results count="5" longitude="-75.6055402" latitude="39.9172668"/>
<marker i="0" lat="39.916752" lng="-75.603636" id="5530696" price="674,900.0" city="WEST CHESTER" property_type="Residential" beds="4" baths="" address="1040 LITTLE RIDGE" ph="12"/>
<marker i="1" lat="39.921965" lng="-75.611748" id="5516722" price="585,000.0" city="WEST CHESTER" property_type="Residential" beds="4" baths="" address="1047 COUNTRY CLUB" ph="12"/>
<marker i="2" lat="39.912890" lng="-75.603612" id="5514806" price="669,900.0" city="WEST CHESTER" property_type="Residential" beds="4" baths="" address="1002 SABER" ph="12"/>
<marker i="3" lat="39.917580" lng="-75.603868" id="5494900" price="700,000.0" city="WEST CHESTER" property_type="Residential" beds="5" baths="" address="1052 CEDAR MILL" ph="12"/>
<marker i="4" lat="39.917147" lng="-75.604837" id="5482705" price="629,900.0" city="WEST CHESTER" property_type="Residential" beds="4" baths="" address="1001 CEDAR MILL" ph="12"/>
</markers>};

Open in new window

0
webguy62Author Commented:
RE: adam suggestion

http://www.simplechoicerealty.com/test_marker.pl   this works :) so we have eliminated apache config :)

RE;mrjoltcola: suggestion.   I have passed this on to our php guys. They will try this. thnx
0
mrjoltcolaCommented:
>>RE;mrjoltcola: suggestion.   I have passed this on to our php guys. They will try this. thnx

Its not a PHP suggestion. It is in the gdata.pl script that you need to try commenting out any:  print "Content-type...."

I'm still not convinced it is NOT Apache, I think it is, but I am proposing a workaround, ie. don't specify the content-type in your script, let whatever mysterious entity that is doing it keep doing it. Your AJAX code _might_ be able to parse it regardless of the content-type header. If this turns out to be false, though, you'll still have to fix the underlying problem correctly and revert back to the explicit content-type of xml.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Adam314Commented:
>>so we have eliminated apache config :)
Not quite... If this script failed, then it is apache config.  If this script succeeds, it could be apache config, or your script.

I'm not an apache expert either, and I'm not familiar with all the modules - there may be something that is injecting a header.  If there is, I'm guessing it's because your script is not generating valid one.  Instead of printing a header with this:
    print "Content-Type: text/xml; charset=ISO-8859-1\n\n";
You should use the header function from the CGI module, as the header you have here is technically not valid (improper line endings).  

Try chaning line (approx) 24 from this:
    print "Content-Type: text/xml; charset=ISO-8859-1\n\n";
To this:
    print $cgi->header('text/xml');


And chainging lines (approx) 137 and 138 from this:
    print "Pragma: no-cache\n";
    print "Content-Type: text/xml; charset=ISO-8859-1\n\n";
To this:
    print $cgi->header(-Type=>'text/xml', -Pragma => 'no-cache');
0
webguy62Author Commented:
Tnanks big time guys.  It now works as it should.  We commkented the lines 137 and 138 and added this  print $cgi->header(-Type=>'text/xml', -Pragma => 'no-cache');
   all is well.

thnks again.  Our cleint is very happy
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.