Sedang Disiapkan

Modification of php code in order to fits our demand!

I need someone to modify the following code in order that it can grab 2 different html pages:

?php

/*

$Id: [url removed, login to view], v1.0 01/16/2008 osC forum - id chris23

Provides courier tracking for Swiss Post

This script will be called via ajax from [url removed, login to view] and admin/[url removed, login to view]

osCommerce, Open Source E-Commerce Solutions

[url removed, login to view]

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 [url removed, login to view]; InfoPath.1; .NET CLR [url removed, login to view])"; // 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");

?>

Kemahiran: PHP

Lihat lebih lanjut: strip_attributes php, php code order, write content solutions, swiss solutions, source php forum, property id, post and courier, php tags, php style, php id, php forum open source, out in public, our code, open table com, no code, is ajax open source, in demand, id to code, html 5 img, forum php html, direct general, direct fix, delivery agent, code 8 com, code 8

Tentang Majikan:
( 0 ulasan ) Lucerne, Switzerland

ID Projek: #326659

Dianugerahkan kepada:

COGWebTech

Hi, Please check PMB for other detail and lets start doing this project. Regards

$150 USD dalam 3 hari
(0 Ulasan)
0.0

6 pekerja bebas membida secara purata $154 untuk pekerjaan ini

lightcresent

get it done within next 3 hours... Thanks

$45 USD dalam 0 hari
(480 Ulasan)
9.0
softwaredep

Lets start. Thank you.

$200 USD dalam 6 hari
(99 Ulasan)
7.0
wincent

quick work. ready to start right now.

$30 USD dalam 0 hari
(79 Ulasan)
6.0
ossolution4u

We have similar projects here, the team with over 7 years working experiences. please kindly check PMB for details, thank you.

$250 USD dalam 5 hari
(5 Ulasan)
2.7
onlywebsite

See PMB. Thank you.

$250 USD dalam 5 hari
(5 Ulasan)
2.4