$value) { if (!curl_setopt($ch, $option, $value)) { return false; } } return true; } } function get_web_page( $url ) { // basically ASP page doesent use any xml as it looks to be by using msxml ... etc $arr = explode("&",$url) ; for($i=1;$i<=count($arr)-1;$i++) { $tmp = explode("=",$arr[$i]); if(isset($tmp[1])) { $url = str_replace($tmp[1],urlencode($tmp[1]),$url); } } $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "spider", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; //print ($url); //print_r($header); //die(); return $header; } function replace_query_ASP() { $tmp = ""; foreach($_GET as $x => $Y) { $tmp .= $x."=".$Y."&"; } return $tmp ;// find out how request.querystring behaves . } ?> Details
__USERTITLE__
 
Change Search Criteria

") //sURL = "/privatelabel/listing/pl_boat_detail.jsp?&units=Feet&checked_boats=1448887&slim=pp254585&" 'Yacht Detail } if ($sURL!= "" && (strpos($_GET["rPage"],"pl_search_results.jsp") ? strpos($_GET["rPage"],"pl_search_results.jsp")+1 : 0)>0) { $_SESSION['searchResultsURL']=str_replace($BaseURL,"",$sURL); } // replace Msxml2.ServerXMLHTTP with PHP might . //die($sURL); $result = get_web_page($sURL); //die($result['content']); if($result['http_code']!=200) { $pageHTML = "

An Error Occurred

Sorry, but we are not able to complete the search at the moment.

Error Code: 200

"; } else { $pageHTML = $result['content']; } //print_r($result); function drawImage($idNumber) { global $pageHTML , $out; // $idNumber = $out[1][] passed as a param $imgPath = ""; for ($i=1; $i<=5; $i=$i+1) { $imgPath=$imgPath.substr(substr($idNumber,0,$i),strlen(substr($idNumber,0,$i))-(strlen(substr($idNumber,0,$i))-($i-1)))."/"; } // |<---- this is 169 characters -------------------------------------------------------------------------------------------------------------------------------------------------------------->| // Add hyperlink to thumbnail image preg_match("/&boat_id={$idNumber}&primary_photo_id=\d+/", $pageHTML, $match); preg_match("/&primary_photo_id=\d+/", $match[0], $match); preg_match("/\d+/", $match[0], $match); if(preg_match("/&boat_id={$idNumber}&primary_photo_id={$match[0]}&primary_photo_url=.*[A-Za-z0-9_%\.]&back/", $pageHTML)){ preg_match("/&boat_id={$idNumber}&primary_photo_id={$match[0]}&primary_photo_url=.*[A-Za-z0-9_%\.]&back/", $pageHTML, $newurlmatch); preg_match("/&primary_photo_url=.*[A-Za-z0-9_%\.]&back/", $newurlmatch[0], $newurlmatch); preg_match("/http.*[A-Za-z0-9_%\.].jpg/", $newurlmatch[0], $newurlmatch); $imgNewSrc=urldecode($newurlmatch[0])."?w=300&h=300&t=".time(); $imgPath=""; } else{ $imgPath=""; } // |<---------- this 54 characters if boat_id is 7 digits -------------->| $pageHTML=str_replace("",$imgPath,$pageHTML); return; } preg_match_all("" , $pageHTML,$out, PREG_PATTERN_ORDER); //print_r($out); foreach ($out[1] as $tempID) { drawImage($tempID); } $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("width=650 bgcolor=\"#FFFFFF\"","width=\"100%\"",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("summary=\"search_results\"","summary=\"search_results\" width=\"100%\"",$pageHTML); //Replace images $pageHTML=str_replace("\"*\"","\"Full",$pageHTML); $pageHTML=str_replace("view full listings for all the boats on this page.","",$pageHTML); //$pageHTML=str_replace("\"*\"","\"Full",$pageHTML); // $pageHTML=str_replace("/","\"Full ",$pageHTML,1); } // Replace images of Photo's available foreach ($out[1] as $tempID) { $pageHTML=preg_replace("//","\"Photo's",$pageHTML,1); } $pageHTML=str_replace("","\"Full",$pageHTML); $pageHTML=str_replace("","\"Photo's",$pageHTML); $pageHTML=str_replace("","\"Photo's",$pageHTML); $pageHTML=str_replace("","\"Photo's",$pageHTML); $pageHTML=str_replace("","\"Photo's ",$pageHTML); $pageHTML=str_replace("","\"Fairline",$pageHTML); //$pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); //$pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); //Form $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace(" ","",$pageHTML); //Paging image links $pageHTML=str_replace("","\"Next",$pageHTML); $pageHTML=str_replace("","\"Previous",$pageHTML); //Replace hyperlinks $pageHTML=str_replace("href=\"../../","href=\"?rPage=/privatelabel/",$pageHTML); $pageHTML=str_replace("href='../","href='?rPage=/privatelabel/",$pageHTML); $pageHTML=str_replace("href=\"/privatelabel/","href=\"?rPage=/privatelabel/",$pageHTML); $pageHTML=str_replace("href='/privatelabel/","href='?rPage=/privatelabel/",$pageHTML); $pageHTML=str_replace("href=\"../listing/","href=\"?rPage=/privatelabel/listing/",$pageHTML); $pageHTML=str_replace("href=/privatelabel/","href=?rPage=/privatelabel/",$pageHTML); //other tags $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("type=\"button\"","type=\"button\" class=\"hidden\" style=\"margin-top: 4px; \"",$pageHTML); $pageHTML=str_replace("type=\"submit\"","type=\"submit\" class=\"hidden\" style=\"margin-top: 4px; \"",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("
","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("
","",$pageHTML); $pageHTML=str_replace("
","
",$pageHTML); //fix table width on specs page $pageHTML=str_replace("width=95%","",$pageHTML); $pageHTML=str_replace("width=90%","",$pageHTML); $pageHTML=str_replace("
".chr(10)."
 
","
",$pageHTML); //fix link target for contact link at bottom of boat details page $pageHTML=str_replace("target=\"_self\"","target=\"_blank\"",$pageHTML); //Remove Codes column $pageHTML=str_replace("Codes","",$pageHTML); $pageHTML=str_replace("P U T D FG  ","",$pageHTML); $pageHTML=str_replace("P U T D CP  ","",$pageHTML); $pageHTML=str_replace("P U O D FG  ","",$pageHTML); $pageHTML=str_replace("P U T G FG  ","",$pageHTML); //Boat details page //If InStr(Request.QueryString("rPage"), "pl_boat_detail_handler.jsp") > 0 then $pageHTML=str_replace("Boat Loans","",$pageHTML); $pageHTML=str_replace(">Full specs",">",$pageHTML); $pageHTML=str_replace(">Full specs",">",$pageHTML); $pageHTML=str_replace(">\"Photo",">",$pageHTML); $pageHTML=str_replace(">\"Photo",">",$pageHTML); $pageHTML=str_replace(">Email",">",$pageHTML); $pageHTML=str_replace(">\"Email\"",">",$pageHTML); $pageHTML=str_replace(">\"Email\"",">",$pageHTML); $pageHTML=str_replace("
","
",$pageHTML); preg_match_all("/

(.*)<\/h3>/" , $pageHTML,$out,PREG_OFFSET_CAPTURE); if(isset($out[0][0][0])) { $pageHTML=str_replace($out[0][0][0],"",$pageHTML); } preg_match_all("|
(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n|" , $pageHTML,$out,PREG_OFFSET_CAPTURE); // the above expression is tooo bad , but ok for the time being , could'nt think of any other way which worked . $mValue=str_replace(chr(10),"",$out[0][0][0]); $mValue=str_replace("'","\"",$mValue); $mValue=str_replace("

","",$mValue); $mValue=str_replace("
","",$mValue); $mValue=str_replace("","",$mValue); $mValue=str_replace("","",$mValue); $mValue=str_replace("","",$mValue); $mValue=str_replace("","",$mValue); $mValue=str_replace("class=\"hideOnPrint\"","id=\"hideOnPrint\"",$mValue); $mValue=str_replace("\"Warranty","",$mValue); $pageHTML=str_replace($out[0][0][0],$mValue,$pageHTML); //upto line number -- 202 of ASP // starting from line number preg_match_all("|(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n|" , $pageHTML,$out,PREG_OFFSET_CAPTURE); $pageHTML=str_replace($out[0][0][0],"",$pageHTML); // at this moment we have that table -- return to --- etc in preg_match_all("|The URL has moved |" , $pageHTML,$out,PREG_OFFSET_CAPTURE); if(isset($out[0][0][0])) { $pageHTML = str_replace($out[0][0][0],"" ,$pageHTML); } $pageHTML=str_replace("Click on one boat to view the full listing, or ","",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("class=blue","",$pageHTML); $pageHTML=str_replace(">Length"," style=\"text-align: right;\">Length",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("href=../listing","href=?rPage=/privatelabel/listing",$pageHTML); $pageHTML=str_replace("","",$pageHTML); $pageHTML=str_replace("table width=\"616\"","table width=\"100%\"",$pageHTML); $pageHTML=str_replace("bgcolor=\"#5A79BB\"","class=\"galleryNav\"",$pageHTML); $pageHTML=str_replace("color:#ffff00;","color:white;",$pageHTML); $pageHTML=str_replace("style=\"width:615px;","style=\"width:600px;",$pageHTML); $pageHTML=str_replace("target=\"_blank\" >Email Us",">Contact Us",$pageHTML); $pageHTML=str_replace("style=\"text-decoration:none; color:white;\"","style=\"text-decoration: none; color: #333333; text-align: right;\"",$pageHTML); $pageHTML=str_replace("style=\"color:#ffff00; height:21px; overflow:auto; ","style=\"color: #333333; font-weight: bold;",$pageHTML); $pageHTML=str_replace("style=\"color:white; height:21px; overflow:auto; padding:1px\"","style=\"color:#333333; font-weight: bold; height:21px; overflow:auto; padding:1px\"",$pageHTML); $pageHTML = str_replace("P=Power, S=Sail, C=Commercial
N=New, U=Used
S=Single, T=Twin, D=Diesel, G=Gas/Petrol
W=Wood, ST=Steel, AL=Aluminum, FG=Fiberglass, CP=Composite, FC=Ferro-Cement","",$pageHTML); $pageHTML = str_replace("
O=Other/None,","",$pageHTML); echo $pageHTML; } else { print "

Server Error

"; print "

This page is intended for use on www. only.

"; } ?>