PHP Classes

Error on running script

Recommend this page to a friend!

      UPS XML Package Tracking  >  All threads  >  Error on running script  >  (Un) Subscribe thread alerts  
Subject:Error on running script
Summary:Problem testing this script
Messages:4
Author:Nigel Wainwright
Date:2006-04-20 21:46:35
Update:2006-04-21 16:42:26
 

  1. Error on running script   Reply   Report abuse  
Picture of Nigel Wainwright Nigel Wainwright - 2006-04-20 21:46:35
I have tried this class but I get the following error:


Fatal error: Call to a member function on a non-object in /home/xxxxxx/xxxxxxx/mysite/index.php on line 33

This is my test code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<?php
include 'ups_tracker.class.php';
?>

</head>


<body>


<input name="n" type="hidden" value="1Z 433 917 03 5195 331 2">

<?php
$n = $_GET['n']; //UPS number to track
$foo = new UPS_XML_PACKAGE_TRACKER();
$foo->setActivity('activity'); //if 0 , it will display only last status
$foo->settTackingNumber($n);
$foo->request_init(ups_userid,ups_xml_access_key,hell_world);
$foo->send_request();
$response = $foo->getResponseData();


$bar = new UPS_XML_PACKAGE_TRACKER_HTML_RESPONSE();
$bar->init($response,$n);
$bar->html();
$result = $bar->gethtml();
$render->assign("result", $result); //smarty :)
?>
</body>
</html>


I would appreciate any help you can give as this would be really useful script for my shopping cart.

  2. Re: Error on running script   Reply   Report abuse  
Picture of Sergey Shilko Sergey Shilko - 2006-04-21 08:05:08 - In reply to message 1 from Nigel Wainwright
$render->assign

it`s a Smarty Template Engine.

if you are not using Smarty, do a simple

<?php

echo $arg;

?>

  3. Re: Error on running script   Reply   Report abuse  
Picture of Sergey Shilko Sergey Shilko - 2006-04-21 08:09:52 - In reply to message 1 from Nigel Wainwright
$result = $bar->gethtml();
$render->assign("result", $result); //smarty :)

$result is a HTML-code already,

do a
-----------
echo $result;
-----------
instead of
------------
$render->assign("result", $result); //smarty :)
------------

  4. Re: Error on running script   Reply   Report abuse  
Picture of Nigel Wainwright Nigel Wainwright - 2006-04-21 16:42:26 - In reply to message 3 from Sergey Shilko
Thank you for the quick reply to my problem. I have made the suggested change and the script now appears to work but I get the error:

Error The XML document is well formed but the document is not valid

I know that the UPS tracking number that I am using is okay as I can check the details directly on the UPS website.

I am not so good with php so much of this is new to me.

Any help is always appreciated.

Nigel