#!c:\Perl\bin\perl5.8.0.exe # Rob Waite 09/2003 # generate AVS data from Helpful Holidays use CGI; use Sprite; use LWP::Simple; use DBI; use Time::Local; use File::Copy; use MIME::Lite; use LWP::UserAgent; $ua = new LWP::UserAgent; $timeout = 60; # *************************** get descriptions & photos ******************************* # &get_date; &desc; # &get_star; # &array_onde; # &get_AVS; # &email; $ondefile = "C:/tmp/onde.txt"; sub desc { $logfile = "C:/tmp/HHOL/LOG.".$$; $property = 1; &get_date; open(HHOL, "C:/tmp/HHOL/HHOL.txt") || die ("unable to open HHOL file"); while(my @HHOLid = split /=[^\n]*\n/, ) { foreach $HHOLid (@HHOLid) { print ("Property $property: $HHOLid \n"); $tmp = "C:/tmp/HHOL/Text/HHOL-".$HHOLid.".txt"; $src = "http://www.helpfulholidays.com/property.asp?ref=".$HHOLid."&year=".$year; sleep (rand 10); $_ = get($src); $star_ = $_; if ($_ =~ /No Active/) { print ("$HHOLid does not exist on Helpful Holidays\n"); open(LOG,">>$logfile"); print LOG "Proprty: ".$HHOLid." does not exist on Helpful Holidays\n"; close LOG; } else { $pic_ = $_; @dat = split(/Provisionally book this Property">/, $_); $_ = $dat[1]; @dat = split(/<\/DIV>/i, $_,); $_ = $dat[0]; $_ =~ s/<[^>]*>//g; $_ =~ s/\s/ /g; $_ =~ s/ / /gs; $_ =~ s/ +//gs; $_ =~ s/\&[^\;]*\;//g; $_ =~ s/\.\.\. a/\n\nA/g; $_ =~ s/\.\.\.a/\n\nA/g; $_ =~ s/\.\.\. b/\n\nB/g; $_ =~ s/\.\.\. /\n\n/g; $_ =~ s/ ½ / 0.5 /g; $_ =~ s/½|½./.5 /g; $_ =~ s/ ¼ / 0.25 /g; $_ =~ s/¼|¼./.25 /g; $_ =~ s/ ¾ / 0.75 /g; $_ =~ s/¾|¾./.75 /g; $_ =~ s/ \././g; $_ =~ s/ ,/,/g; $_ =~ s/ \;/;/g; $_ =~ s/'|'/'/g; $_ =~ s/"|"/"/g; if (@dat = split(/Other properties/,$_)) { $_ = $dat[0]; } ☆ open (TD, ">$tmp"); print TD "Star rating: ".$star."\n\nSleeps: ".$sleeps."\n\nBedrooms: ".$beds."\n\n".$_."\n\nChangeover Day: ".$change."\n\nThese star ratings are unique in that they rely enormously heavily on the experience of the inspectors, members of our staff who have seen hundreds of houses. They check everything we can think might be relevant to your holiday enjoyment, from basic cleanliness to whether the colour of the curtains goes with the duvet covers, and then they grade the property on the basis of all of these things. They remain, however, strictly personal assessments, in the best of faith, of interior quality and ambience only. They have nothing to do with the outward appearance or situation. Nor are they necessarily directly related to the quality or quantity of 'gadgets'. Tick boxes ? ... well, some, yes, but mostly it's about ambience, tone and comfort, all looked at with a good dollop of common sense.\n\nProperties rated 5 star now would have been miles off the scale 10 years ago and as standards continue to charge upwards we constantly review to ensure that our star ratings remain useful. The greatest praise of them is, perhaps, the degree to which our customers of many years tell us they rely on our star ratings ABOVE ALL ELSE in their search for a perfect holiday place. The fact they have been appreciated by so many people for so many years makes us feel we are doing something right.\n\n1 Star means what we would call 'basic', i.e. it has all the basic necessities but contains little or nothing that is new or smart. However, it may well have charm. A surprising number of people say 'basic' is what they want.\n\n2 Star is better furnished and equipped: often very pleasant, quite attractive and friendly - just a little old fashioned. Or, alternatively, more functional than beautiful.\n\n3 Star good quality and thoroughly efficient, a considerable and successful effort made to make it attractive; well-equipped; almost always fitted kitchens.\n\n3 and a half Stars means better quality.\n\n4 Star means excellent, 'own home' feeling, very good quality, attractive and well furnished and probably (though not necessarily - see individual descriptions) extremely well-equipped; or in some other way special.\n\n4 and a half Star means all that and more.\n\n5 Star means exceptional.\n\nMore people say we malign places than that we over-rate them. And please don't forget 1 and a half and 2 Star properties may be in marvellous situations."; close TD; &email; @pics = split(/Additional Pictures and Videos:/, $pic_, 2); $pic_ = $pics[1]; @pics = split(/build( From => 'chinecot@btopenworld.co.uk', To => 'waiterm@hotmail.com', Subject => 'HC 0', Type => 'Multipart/mixed'); $msg->attach( Type => 'text image/jpg', Path => $tmp2, Filename => $filename, Disposition => 'attachment'); $msg->send('smtp', "mail.btopenworld.com"); } sub emailpics { $filename = "HHOL-".$HHOLid.".txt"; $msg = MIME::Lite->build( From => 'chinecot@btopenworld.co.uk', To => 'waiterm@hotmail.com', Subject => 'HC 0', Type => 'Multipart/mixed'); $msg->attach( Type => 'text file/txt', Path => $tmp, Filename => $filename, Disposition => 'attachment'); $msg->send('smtp', "mail.btopenworld.com"); }