I need someone to modify the following code in order that it can grab 2 different html pages:?php /* $Id: sp_tracking.php, v1.0 01/16/2008 osC forum - id chris23 Provides courier tracking for Swiss Post This script will be called via ajax from account_history_info.php and admin/orders.php osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // prevent direct calls to this page if (!isset($_GET['tracking_id'])) { die('Direct call to script. Exiting.'); } require("includes/application_top.php"); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TRACKING_MODULE); $tracking_number = $_GET['tracking_id']; $sp_get_receiver_url = TRACKING_GET_URL_SP; $params = "&DCSext.wt_shortcut=swisspost-tracking"; $agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)"; // dummy UA $url = $sp_get_receiver_url . $tracking_number . $params; //echo $url; die(); /* no redirects for ie so grab data and clean */ $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $grab_data = curl_exec($ch); if ($error = curl_errno($ch)) { if ($error == 7) { die(TRACKING_CURL_SERVER_ERROR); } if ($error == 6) { die(TRACKING_CURL_NO_ACTIVE_INTERNET); } } curl_close($ch); // tidy extraneous whitespace - use on all grabs $grab_data = str_replace("n", "", $grab_data); $grab_data = str_replace("r", "", $grab_data); $grab_data = str_replace("t", "", $grab_data); $grab_data = str_replace(" ", "", $grab_data); $pat[0] = "/^s+/"; $pat[1] = "/s{2,}/"; $pat[2] = "/s+$/"; $rep[0] = ""; $rep[1] = " "; $rep[2] = ""; $grab_data = preg_replace($pat, $rep, $grab_data); // set html start and end grab $StartGrab = '<!--bean:write name="parcelEvent" property="product"/-->'; $EndGrab = '<!-- FINE Packet post-->'; // Grab delivery status information $text = eregi("$StartGrab(.*)$EndGrab", $grab_data, $content); // start custom tidying // strip tags - keep tracking table $content = strip_tags($content[1], '<table><tr><th></th><td></td></tr></table>'); // remove all html attributes function strip_attributes($msg, $tag, $attr) { $lengthfirst = 0; while (strstr(substr($msg, $lengthfirst), "<$tag ") != "") { $imgstart = $lengthfirst + strpos(substr($msg, $lengthfirst), "<$tag "); $partafterwith = substr($msg, $imgstart); $img = substr($partafterwith, 0, strpos($partafterwith, ">")+1); $img = str_replace(" =", "=", $msg); $out = "<$tag"; for($i = 0; $i <= (count($attr) - 1 ); $i++) { $long_val = strpos($img, " ", strpos($img, $attr[$i]."=")) - (strpos($img, $attr[$i]."=") + strlen($attr[$i]) + 1) ; $val = substr($img, strpos($img, $attr[$i]."=") + strlen($attr[$i]) + 1, $long_val); if (strlen($val) > 0) $attr[$i] = " ".$attr[$i]."=".$val; else $attr[$i] = ""; $out .= $attr[$i]; } $out .= ">"; $partafter = substr($partafterwith, strpos($partafterwith, ">")+1); $msg = substr($msg, 0, $imgstart).$out.$partafter; $lengthfirst = $imgstart+3; } return $msg; } $content = strip_attributes($content, "tr", array()); $content = strip_attributes($content, "td", array()); $content = preg_replace("/writeBgColor(d{1});/","", $content); // fix table font size $content = str_replace("<table border="0" cellpadding="0" cellspacing="0" width="496">","<table border="0" cellpadding="0" cellspacing="0" width="100%" style="font-size: 11px; padding: 5px 0 5px 0;">",$content); echo $content; // the following function may be needed if remote server returns utf encoding (parent osC page is iso-8859) - prevents ? characters appearing // uncomment if returned text contains ? in a little diamond.echo mb_convert_encoding($output,"UTF-8","ISO-8859-1");?>I need someone to modify the following code in order that it can grab 2 different html pages:?php /* $Id: sp_tracking.php, v1.0 01/16/2008 osC forum - id chris23 Provides courier tracking for Swiss Post This script will be called via ajax from account_history_info.php and admin/orders.php osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // prevent direct calls to this page if (!isset($_GET['tracking_id'])) { die('Direct call to script. Exiting.'); } require("includes/application_top.php"); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TRACKING_MODULE); $tracking_number = $_GET['tracking_id']; $sp_get_receiver_url = TRACKING_GET_URL_SP; $params = "&DCSext.wt_shortcut=swisspost-tracking"; $agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)"; // dummy UA $url = $sp_get_receiver_url . $tracking_number . $params; //echo $url; die(); /* no redirects for ie so grab data and clean */ $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $grab_data = curl_exec($ch); if ($error = curl_errno($ch)) { if ($error == 7) { die(TRACKING_CURL_SERVER_ERROR); } if ($error == 6) { die(TRACKING_CURL_NO_ACTIVE_INTERNET); } } curl_close($ch); // tidy extraneous whitespace - use on all grabs $grab_data = str_replace("n", "", $grab_data); $grab_data = str_replace("r", "", $grab_data); $grab_data = str_replace("t", "", $grab_data); $grab_data = str_replace(" ", "", $grab_data); $pat[0] = "/^s+/"; $pat[1] = "/s{2,}/"; $pat[2] = "/s+$/"; $rep[0] = ""; $rep[1] = " "; $rep[2] = ""; $grab_data = preg_replace($pat, $rep, $grab_data); // set html start and end grab $StartGrab = '<!--bean:write name="parcelEvent" property="product"/-->'; $EndGrab = '<!-- FINE Packet post-->'; // Grab delivery status information $text = eregi("$StartGrab(.*)$EndGrab", $grab_data, $content); // start custom tidying // strip tags - keep tracking table $content = strip_tags($content[1], '<table><tr><th></th><td></td></tr></table>'); // remove all html attributes function strip_attributes($msg, $tag, $attr) { $lengthfirst = 0; while (strstr(substr($msg, $lengthfirst), "<$tag ") != "") { $imgstart = $lengthfirst + strpos(substr($msg, $lengthfirst), "<$tag "); $partafterwith = substr($msg, $imgstart); $img = substr($partafterwith, 0, strpos($partafterwith, ">")+1); $img = str_replace(" =", "=", $msg); $out = "<$tag"; for($i = 0; $i <= (count($attr) - 1 ); $i++) { $long_val = strpos($img, " ", strpos($img, $attr[$i]."=")) - (strpos($img, $attr[$i]."=") + strlen($attr[$i]) + 1) ; $val = substr($img, strpos($img, $attr[$i]."=") + strlen($attr[$i]) + 1, $long_val); if (strlen($val) > 0) $attr[$i] = " ".$attr[$i]."=".$val; else $attr[$i] = ""; $out .= $attr[$i]; } $out .= ">"; $partafter = substr($partafterwith, strpos($partafterwith, ">")+1); $msg = substr($msg, 0, $imgstart).$out.$partafter; $lengthfirst = $imgstart+3; } return $msg; } $content = strip_attributes($content, "tr", array()); $content = strip_attributes($content, "td", array()); $content = preg_replace("/writeBgColor(d{1});/","", $content); // fix table font size $content = str_replace("<table border="0" cellpadding="0" cellspacing="0" width="496">","<table border="0" cellpadding="0" cellspacing="0" width="100%" style="font-size: 11px; padding: 5px 0 5px 0;">",$content); echo $content; // the following function may be needed if remote server returns utf encoding (parent osC page is iso-8859) - prevents ? characters appearing // uncomment if returned text contains ? in a little diamond.echo mb_convert_encoding($output,"UTF-8","ISO-8859-1");?>