Jump to content



Photo
* * * * * 2 votes

FedEx - Web Services v9


  • Please log in to reply
628 replies to this topic

#241   lifeisboost

lifeisboost
  • Members
  • 86 posts
  • Real Name:Peter

Posted 05 June 2012 - 14:23

For the OE to work i atucally edited this line

$totals = $order->info['subtotal'] || $_SESSION['cart']->show_total();

to this and it also works

$totals = $cart->show_total();


#242   TheJackal

TheJackal
  • Members
  • 175 posts
  • Real Name:Jackal
  • Gender:Male
  • Location:San Francisco

Posted 05 June 2012 - 17:07

For everyone's info, FedEx has officially ended API support today.

If you have SOAP problem or any issues with web services and you are in USA, you still have one option: using the local zone rates contribution: http://addons.oscommerce.com/info/490
- The Jackal

#243   greasemonkey

greasemonkey
  • Members
  • 407 posts
  • Real Name:Scott
  • Gender:Male

Posted 05 June 2012 - 17:52

Well... I guess we all new this day was coming... I'm back up and running with webservices! Thank you for all your hard work.

However, what I did not expect was Fedex Automatic Labels is ALSO now down;

This transaction could not be completed. Please note the error message below.

ERROR: FedEx Return Error 0531 : FedEx Ship Manager API has been retired. Please use an alternate FedEx solution, or go to http://www.fedex.com.../migration.html for more information.

Has anyone made any progress with Fedex Automatic Labels??????????

#244   Roaddoctor

Roaddoctor
  • Members
  • 1,044 posts
  • Real Name:David Jennings
  • Gender:Not Telling
  • Location:Texas

Posted 05 June 2012 - 18:51

Well... I guess we all new this day was coming... I'm back up and running with webservices! Thank you for all your hard work.

However, what I did not expect was Fedex Automatic Labels is ALSO now down;

This transaction could not be completed. Please note the error message below.

ERROR: FedEx Return Error 0531 : FedEx Ship Manager API has been retired. Please use an alternate FedEx solution, or go to http://www.fedex.com.../migration.html for more information.

Has anyone made any progress with Fedex Automatic Labels??????????


Someone will need to step up to update (pretty much re-write) that contribution for compatability with webservices. The WSDL format is very different from the real time quotes api...
-Dave

#245   greasemonkey

greasemonkey
  • Members
  • 407 posts
  • Real Name:Scott
  • Gender:Male

Posted 05 June 2012 - 19:27

Someone will need to step up to update (pretty much re-write) that contribution for compatability with webservices. The WSDL format is very different from the real time quotes api...


Ouch... I have been looking at it... at it is WAY beyond my skills.

All I've figured out is, in the 2 fedexdc.php file, changing the servers from http://gateway.fedex.com:443/gatewayDC to;

if ($server == 'test') {
define('FEDEX_URI', 'https://ws.fedex.com:443/web-services', true);
define('FEDEX_HOST', 'ws.fedex.com', true);
}
elseif ($server == 'production') {
define('FEDEX_URI', 'https://ws.fedex.com:443/web-services', true);
define('FEDEX_HOST', 'ws.fedex.com', true);

And all the FEDEX1 in ship_fedex.php to FEDEXWEBSERIVCES

Obviously my look at this is VERY simplistic.... these files need to be changed to include the following;

$this->fedex_key
$this->fedex_pwd
$this->fedex_act_num
$this->fedex_meter_num

And then match them to the fedex-vars

10=>'MODULE_SHIPPING_FEDEXWEBSERIVCES_ACCOUNT', // 0 ??????????????????????????????
498=>'MODULE_SHIPPING_FEDEXWEBSERIVCES_METER', // 1????????????????????????????????
???? Need Number for fedex_key
???? Need number for fedex_pwd

Anyone out there (with actual skills... unlike "me"... LOL) working on this?????

#246   greasemonkey

greasemonkey
  • Members
  • 407 posts
  • Real Name:Scott
  • Gender:Male

Posted 06 June 2012 - 00:25

Ok Roaddoctor, I downloaded the ShipService WSDL guide and code and I see what you mean... This is so far beyond me...

If someone is working on this and needs help testing please let me know. Beyond that I'm afraid I useless...

#247   PHPjoel

PHPjoel
  • Members
  • 4 posts
  • Real Name:Joel
  • Gender:Male
  • Location:NY

Posted 06 June 2012 - 21:25

I have upgraded to FedExWebServices using this addon.

I am also using the Shipping Labels... The addon that uses ship_fedex.php and fedexdc.php.

I don't know how much longer fedexdc.php will be supported by FedEx, but it seems to work right now.

To get the Shipping Labels to work again, I did the following:
  • Change MODULE_SHIPPING_FEDEX1_ mentions to their MODULE_SHIPPING_FEDEX_WEB_SERVICES_ equivalent in both ship_fedex.php and purchase_ship_fedex.php
  • After doing that, I was getting "ERROR: FedEx Return Error F01F : Weight type not pounds (LBS) nor kilograms (KGS)" @ ship_fedex.php
  • Since the WebServices (for shipping quotes in the cart) requires weight to be LB or KG, I made the following edit for ship_fedex.php:
foreach($fedex_vars as $var) {
  $value_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = '" . $var . "'");
  $value = tep_db_fetch_array($value_query);
  // append an 'S' to the weight unit @phpJoel
  if($var == 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT') $value['configuration_value'] = $value['configuration_value'] . 'S';
  $value = $value['configuration_value'];


The labels are now being displayed again.
This hasn't been thoroughly tested or anything, but my goal was to get the labels working again for the time being.

#248   PHPjoel

PHPjoel
  • Members
  • 4 posts
  • Real Name:Joel
  • Gender:Male
  • Location:NY

Posted 06 June 2012 - 23:53

I also had to do this in purchase_ship_fedex.php


Within:
foreach($fedex_vars as $var) {
add the "S"-addition code..

			  $value_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = '" . $var . "'");
			  $value = tep_db_fetch_array($value_query);
			  // append an 'S' to the weight unit @phpJoel
			  if($var == 'MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT') $value['configuration_value'] = $value['configuration_value'] . 'S';
			  $value = $value['configuration_value'];


#249   JetSet27

JetSet27
  • Members
  • 13 posts
  • Real Name:Jon

Posted 07 June 2012 - 16:15

Many thanks for this contribution! After installing Fedex Web Services 9 on our site (osc 2.2), it seemed to be working fine. But just to be sure I compared the rates which were being quoted on our store with the rates we get simply by logging into the FedEx website. The rates for "FedEx 2 Day" and "FedEx Express Saver" match to the penny. But the rates for "Standard Overnight" and "Priority Overnight" are way off. Just to experiment, I zero'd out all our handling fees, and tried it both with displaying "list" and "account" rates. The numbers do change, but they're still wrong.

Here's an example. We currently have the FedEx shipping module set to display ACCOUNT rates, and add a $5 handling charge. Let's use a hypothetical .8 pound package going from Dallas 75227 to Chicago 60601. Our OSC store quotes the following:
Priority Overnight - $46.90
Standard Overnight - $42.66

But logging into fedex.com and getting a rate quote for the same package with our same account number, we get:
Priority Overnight - $25.41
Standard Overnight - $23.66

Even adding the $5 handling fee to the FedEx quote, you can see that the rates shown on our store are > $15 higher. And yet the rates for FedEx 2 Day and FedEx Express Saver agree perfectly. (These are the 4 services we are offering, so I did not compare any of the other possible rates.)

How can this be happening? And, more importantly, can anyone suggest a fix? I would encourage everyone to try a similar test to make certain that the prices you are displaying have some basis in reality. Thanks.

#250   greasemonkey

greasemonkey
  • Members
  • 407 posts
  • Real Name:Scott
  • Gender:Male

Posted 07 June 2012 - 21:29

Many thanks JOELphp, I don't have a file called purchase_ship_fedex.php... This doesn't seem to be part of the orginal mod.

Change MODULE_SHIPPING_FEDEX1_ mentions to their MODULE_SHIPPING_FEDEX_WEB_SERVICES_ equivalent in both ship_fedex.php and purchase_ship_fedex.php


Any thoughts?

#251   Roaddoctor

Roaddoctor
  • Members
  • 1,044 posts
  • Real Name:David Jennings
  • Gender:Not Telling
  • Location:Texas

Posted 08 June 2012 - 13:34

How can this be happening? And, more importantly, can anyone suggest a fix? I would encourage everyone to try a similar test to make certain that the prices you are displaying have some basis in reality. Thanks.


Start with a call to Fedex Webservices support. It could just be the way your account is setup at their end.

Anyone else with this issue?
-Dave

#252   Roaddoctor

Roaddoctor
  • Members
  • 1,044 posts
  • Real Name:David Jennings
  • Gender:Not Telling
  • Location:Texas

Posted 08 June 2012 - 13:36

Many thanks JOELphp, I don't have a file called purchase_ship_fedex.php... This doesn't seem to be part of the orginal mod.



Any thoughts?


Scrub your entire site for any MODULE_SHIPPING_FEDEX1_ references
any files with the old references should be updated... then apply the fixes PHPjoel suggests and test


let us know
-Dave

#253   onegreenspider

onegreenspider
  • Members
  • 3 posts
  • Real Name:Erik chavez

Posted 08 June 2012 - 22:54

Does anyone have a possible solution to Fatal error: Cannot instantiate non-existent class: soapclient in /"myhost"/html/store/includes/modules/shipping/fedexwebservices.php on line 74

#254   onegreenspider

onegreenspider
  • Members
  • 3 posts
  • Real Name:Erik chavez

Posted 09 June 2012 - 00:31

Seems like the only option to get this module working in Godaddy is to get a dedicated or managed server that can cost up to $270 per month. This is because they do not allow shared servers to enable the SOAP extension.

Any suggestions? Is there another module?

Erik

#255   onegreenspider

onegreenspider
  • Members
  • 3 posts
  • Real Name:Erik chavez

Posted 09 June 2012 - 01:07

Something weird happened after almost giving up on this module and SOAP extension not supported by Godaddy. I finally decided to disable it and enable the old Fedex Module I had and surprise! everything works perfectly with the Old extension using the new information I got from Fedex.

/w00t.gif' class='bbc_emoticon' alt='(w00t)' /> /sweatingbullets.gif' class='bbc_emoticon' alt=':sweating:' /> /blink.png' class='bbc_emoticon' alt=':blink:' />

#256   imagixx

imagixx
  • Members
  • 98 posts
  • Real Name:Martin B.
  • Gender:Male

Posted 09 June 2012 - 06:18

http://forums.oscomm...ost__p__1638528

Hi All,

Regarding Automated FedEX labels:

1. I Installed FedEx - Web Services v9 for real time quotes. Now I'm back with quotes. So far so good.

2. Change production server reference in fedexdc.php, and the above replacement suggestions by Joel.

But all I get is a broken "Astra Barcode."

Hope this motivates someone.

#257   bryantbennett99

bryantbennett99
  • Members
  • 1 posts
  • Real Name:Bryant Bennett

Posted 09 June 2012 - 20:59

Anyone familiar with this error and can point me toward solution:

</pre> --><!-- <pre>stdClass Object
(
[HighestSeverity] => ERROR
[Notifications] => stdClass Object
(
[Severity] => ERROR
[Source] => crs
[code=auto:0] => 517
[Message] => A rate request requires at least one requested package line item or one freight shipment line item.
[LocalizedMessage] => A rate request requires at least one requested package line item or one freight shipment line item.
)

[TransactionDetail] => stdClass Object
(
[CustomerTransactionId] => *** Rate Request v9 using PHP ***
)

[Version] => stdClass Object
(
[ServiceId] => crs
[Major] => 9
[Intermediate] => 0
[Minor] => 0
)

)
</pre> --

#258   TpEnEpETE

TpEnEpETE
  • Members
  • 3 posts
  • Real Name:Milen

Posted 10 June 2012 - 06:53

Bryant, it seems like you're missing a <ns1:RequestedPackageLineItems> section in your request.

Posting below is a PHP CURL implementation of a getRates request. Just replace along the tags with your corresponding info.

$rq = '<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/rate/v9"><SOAP-ENV:Body>';

$rq .= '<ns1:RateRequest>';
$rq .= '<ns1:WebAuthenticationDetail>';
$rq .= '<ns1:UserCredential>';
$rq .= '<ns1:Key>'.$this->fedex_key.'</ns1:Key>';
$rq .= '<ns1:Password>'.$this->fedex_pwd.'</ns1:Password>';
$rq .= '</ns1:UserCredential>';
$rq .= '</ns1:WebAuthenticationDetail>';
$rq .= '<ns1:ClientDetail>';
$rq .= '<ns1:AccountNumber>'.$this->fedex_act_num.'</ns1:AccountNumber>';
$rq .= '<ns1:MeterNumber>'.$this->fedex_meter_num.'</ns1:MeterNumber>';
$rq .= '</ns1:ClientDetail>';
$rq .= '<ns1:TransactionDetail>';
$rq .= '<ns1:CustomerTransactionId> *** Rate Request v9 using PHP ***</ns1:CustomerTransactionId>';
$rq .= '</ns1:TransactionDetail>';
$rq .= '<ns1:Version>';
$rq .= '<ns1:ServiceId>crs</ns1:ServiceId>';
$rq .= '<ns1:Major>9</ns1:Major>';
$rq .= '<ns1:Intermediate>0</ns1:Intermediate>';
$rq .= '<ns1:Minor>0</ns1:Minor>';
$rq .= '</ns1:Version>';
$rq .= '<ns1:ReturnTransitAndCommit>true</ns1:ReturnTransitAndCommit>';
$rq .= '<ns1:RequestedShipment>';
$rq .= '<ns1:ShipTimestamp>'.date('Y-m-d\TH:i:s'.substr(date('O'), 0, 3).':'.substr(date('O'), 3)).'</ns1:ShipTimestamp>';
$rq .= '<ns1:DropoffType>'.$this->_setDropOff().'</ns1:DropoffType>';
$rq .= '<ns1:PackagingType>YOUR_PACKAGING</ns1:PackagingType>';
$rq .= '<ns1:TotalInsuredValue>';
$rq .= '<ns1:Currency>USD</ns1:Currency>';
$rq .= '</ns1:TotalInsuredValue>';
$rq .= '<ns1:Shipper>';
$rq .= '<ns1:Address>';
$rq .= '<ns1:StreetLines>'.MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1.'</ns1:StreetLines>';
$rq .= '<ns1:StreetLines>'.MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2.'</ns1:StreetLines>';
$rq .= '<ns1:City>'.MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY.'</ns1:City>';
$rq .= '<ns1:StateOrProvinceCode>'.MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE.'</ns1:StateOrProvinceCode>';
$rq .= '<ns1:PostalCode>'.MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL.'</ns1:PostalCode>';
$rq .= '<ns1:CountryCode>'.$this->country.'</ns1:CountryCode>';
$rq .= '</ns1:Address>';
$rq .= '</ns1:Shipper>';
$rq .= '<ns1:Recipient>';
$rq .= '<ns1:Address>';
$rq .= '<ns1:StreetLines/>';
$rq .= '<ns1:StreetLines/>';
$rq .= '<ns1:PostalCode>'.$pc.'</ns1:PostalCode>';
$rq .= '<ns1:CountryCode>US</ns1:CountryCode>';
$rq .= '<ns1:Residential>true</ns1:Residential>';
$rq .= '</ns1:Address>';
$rq .= '</ns1:Recipient>';
$rq .= '<ns1:ShippingChargesPayment>';
$rq .= '<ns1:PaymentType>SENDER</ns1:PaymentType>';
$rq .= '<ns1:Payor>';
$rq .= '<ns1:AccountNumber>'.$this->fedex_act_num.'</ns1:AccountNumber>';
$rq .= '<ns1:CountryCode>'.$this->country.'</ns1:CountryCode>';
$rq .= '</ns1:Payor>';
$rq .= '</ns1:ShippingChargesPayment>';
$rq .= '<ns1:RateRequestTypes>LIST</ns1:RateRequestTypes>';
$rq .= '<ns1:PackageCount>'.$shipping_num_boxes.'</ns1:PackageCount>';
$rq .= '<ns1:PackageDetail>INDIVIDUAL_PACKAGES</ns1:PackageDetail>';
for ($i=0; $i<$shipping_num_boxes; $i++) {
$rq .= '<ns1:RequestedPackageLineItems>';
$rq .= '<ns1:Weight>';
$rq .= '<ns1:Units>'.MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT.'</ns1:Units>';
$rq .= '<ns1:Value>'.$shipping_weight.'</ns1:Value>';
$rq .= '</ns1:Weight>';
$rq .= '</ns1:RequestedPackageLineItems>';
}
$rq .= '</ns1:RequestedShipment>';
$rq .= '</ns1:RateRequest>';
$rq .= '</SOAP-ENV:Body></SOAP-ENV:Envelope>';

$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, "PHP-SOAP/5.3.9");
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Connection: Keep-Alive', 'Content-Type: text/xml; charset=utf-8', 'SOAPAction: "getRates"', 'Content-Length: '.strlen($rq) ));
curl_setopt($curl, CURLOPT_POSTFIELDS, $rq);
curl_setopt($curl, CURLOPT_URL, "https://gateway.fedex.com/web-services/");
$response = curl_exec($curl);
curl_close($curl);
$response = str_replace('<v9:', '<', $response);
$response = str_replace('</v9:', '</', $response);
$response = str_replace('<env:', '<', $response);
$response = str_replace('</env:', '</', $response);
$response = str_replace('<soapenv:', '<', $response);
$response = str_replace('</soapenv:', '</', $response);

$sxml = new simplexml;
$resp1 = $sxml->xml_load_string($response);
$response = $resp1->Body->RateReply;


As you've probably already noticed the lack of support for soap will pose a couple of problems - providing alternative request mechanism and a lack of soap response parser. My solution to the second problem is a couple of str_replace calls on the response and a simplexml implementation for php4 (which by default lacks an xml_load_string function which I added to have the class looking like so:

if(!class_exists('simplexml')) {
	class simplexml {
	 var $result = array();
	 var $ignore_level = 0;
	 var $skip_empty_values = false;
	 var $php_errormsg;
	 var $evalCode="";
  
	 function curl_get_file_contents($URL)
	 {
	  if(ini_get('allow_url_fopen') != 1) {
	   @ini_set('allow_url_fopen', '1');
	  }
	  if(ini_get('allow_url_fopen') != 1) {
	   $c = curl_init();
	   curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
	   curl_setopt($c, CURLOPT_URL, $URL);
	   $contents = curl_exec($c);
	   curl_close($c);
	  }else{
	   $contents = file_get_contents($URL);
	  }
	  if ($contents) return $contents;
	  else return FALSE;
	 }
  
  
	 /**
	 * Adds Items to Array
	 *
	 * @[member='param'] int $level
	 * @[member='param'] array $tags
	 * @[member='param'] $value
	 * @[member='param'] string $type
	 */
	 function array_insert($level, $tags, $value, $type)
	 {
	  $temp = '';
	  for ($c = $this->ignore_level + 1; $c < $level + 1; $c++) {
	   if (isset($tags[$c]) && (is_numeric(trim($tags[$c])) || trim($tags[$c]))) {
		if (is_numeric($tags[$c])) {
		 $temp .= '[' . $tags[$c] . ']';
		} else {
		 $temp .= '["' . $tags[$c] . '"]';
		}
	   }
	  }
	  //Fix for getting PHP variable like string in XML node values (Contributor:Saulius Okunevicius)
	  $this->evalCode .= '$this->result' . $temp . "= '" . addslashes($value) . "';//(" . $type . ")\n";
	  #echo $code. "\n";
	 }
  
	 /**
	 * Define the repeated tags in XML file so we can set an index
	 *
	 * @[member='param'] array $array
	 * @[member='Return'] array
	 */
	 function xml_tags($array)
	 { $repeats_temp = array();
	  $repeats_count = array();
	  $repeats = array();
  
	  if (is_array($array)) {
	   $n = count($array) - 1;
	   for ($i = 0; $i < $n; $i++) {
		$idn = $array[$i]['tag'].$array[$i]['level'];
		if(in_array($idn,$repeats_temp)){
		 $repeats_count[array_search($idn,$repeats_temp)]+=1;
		}else{
		 array_push($repeats_temp,$idn);
		 $repeats_count[array_search($idn,$repeats_temp)]=1;
		}
	   }
	  }
	  $n = count($repeats_count);
	  for($i=0;$i<$n;$i++){
	   if($repeats_count[$i]>1){
		array_push($repeats,$repeats_temp[$i]);
	   }
	  }
	  unset($repeats_temp);
	  unset($repeats_count);
	  return array_unique($repeats);
	 }
  
  
	 /**
	 * Converts Array Variable to Object Variable
	 *
	 * @[member='param'] array $arg_array
	 * @[member='Return'] $tmp
	 */
	 function array2object ($arg_array)
	 {
  
	  if (is_array($arg_array)) {
	   $keys = array_keys($arg_array);
	   if(!is_numeric($keys[0])) $tmp = new SimpleXMLObject;
	   foreach ($keys as $key) {
		if (is_numeric($key)) $has_number = true;
		if (is_string($key)) $has_string = true;
	   }
	   if (isset($has_number) and !isset($has_string)) {
		foreach ($arg_array as $key => $value) {
		 $tmp[] = $this->array2object($value);
		}
	   } elseif (isset($has_string)) {
		foreach ($arg_array as $key => $value) {
		 if (is_string($key))
		 $tmp->$key = $this->array2object($value);
		}
	   }
	  } elseif (is_object($arg_array)) {
	   foreach ($arg_array as $key => $value) {
		if (is_array($value) or is_object($value))
		$tmp->$key = $this->array2object($value);
		else
		$tmp->$key = $value;
	   }
	  } else {
	   $tmp = $arg_array;
	  }
	  return $tmp; //return the object
	 }
  
	 /**
	 * Reindexes the whole array with ascending numbers
	 *
	 * @[member='param'] array $array
	 * @[member='Return'] array
	 */
	 function array_reindex($array)
	 {
	  if (is_array($array)) {
	   if(count($array) == 1 && array_key_exists(0, $array)){
		return $this->array_reindex($array[0]);
	   }else{
		foreach($array as $keys => $items) {
		 if (is_array($items)) {
		  if (is_numeric($keys)) {
		   $array[$keys] = $this->array_reindex($items);
		  } else {
		   $array[$keys] = $this->array_reindex(array_merge(array(), $items));
		  }
		 }
		}
	   }
	  }
  
	  return $array;
	 }
  
  
	 /**
	 * Parse the XML generation to array object
	 *
	 * @[member='param'] array $array
	 * @[member='Return'] array
	 */
	 function xml_reorganize($array)
	 {
	  $count = count($array);
	  $repeat = $this->xml_tags($array);
	  $repeatedone = false;
	  $tags = array();
	  $k = 0;
	  for ($i = 0; $i < $count; $i++) {
	   switch ($array[$i]['type']) {
	   case 'open':
		array_push($tags, $array[$i]['tag']);
		if ($i > 0 && ($array[$i]['tag'] == $array[$i-1]['tag']) && ($array[$i-1]['type'] == 'close'))
		$k++;
		if (isset($array[$i]['value']) && ($array[$i]['value'] || !$this->skip_empty_values)) {
		 array_push($tags, '@content');
		 $this->array_insert(count($tags), $tags, $array[$i]['value'], "open");
		 array_pop($tags);
		}
  
		if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {
		 if (($repeatedone == $array[$i]['tag'] . $array[$i]['level']) && ($repeatedone)) {
		  array_push($tags, strval($k++));
		 } else {
		  $repeatedone = $array[$i]['tag'] . $array[$i]['level'];
		  array_push($tags, strval($k));
		 }
		}
  
		if (isset($array[$i]['attributes']) && $array[$i]['attributes'] && $array[$i]['level'] != $this->ignore_level) {
		 array_push($tags, '@attributes');
		 foreach ($array[$i]['attributes'] as $attrkey => $attr) {
		  array_push($tags, $attrkey);
		  $this->array_insert(count($tags), $tags, $attr, "open");
		  array_pop($tags);
		 }
		 array_pop($tags);
		}
		break;
  
	   case 'close':
		array_pop($tags);
		if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {
		 if ($repeatedone == $array[$i]['tag'] . $array[$i]['level']) {
		  array_pop($tags);
		 } else {
		  $repeatedone = $array[$i + 1]['tag'] . $array[$i + 1]['level'];
		  array_pop($tags);
		 }
		}
		break;
  
	   case 'complete':
		array_push($tags, $array[$i]['tag']);
		if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {
		 if ($repeatedone == $array[$i]['tag'] . $array[$i]['level'] && $repeatedone) {
		  array_push($tags, strval($k));
		 } else {
		  $repeatedone = $array[$i]['tag'] . $array[$i]['level'];
		  array_push($tags, strval($k));
		 }
		}
  
		if (isset($array[$i]['value']) && ($array[$i]['value'] || !$this->skip_empty_values)) {
		 if (isset($array[$i]['attributes']) && $array[$i]['attributes']) {
		  array_push($tags, '@content');
		  $this->array_insert(count($tags), $tags, $array[$i]['value'], "complete");
		  array_pop($tags);
		 } else {
		  $this->array_insert(count($tags), $tags, $array[$i]['value'], "complete");
		 }
		}
  
		if (isset($array[$i]['attributes']) && $array[$i]['attributes']) {
		 array_push($tags, '@attributes');
		 foreach ($array[$i]['attributes'] as $attrkey => $attr) {
		  array_push($tags, $attrkey);
		  $this->array_insert(count($tags), $tags, $attr, "complete");
		  array_pop($tags);
		 }
		 array_pop($tags);
		}
  
		if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {
		 array_pop($tags);
		 $k++;
		}
  
		array_pop($tags);
		break;
	   }
	  }
	  eval($this->evalCode);
	  $last = $this->array_reindex($this->result);
	  return $last;
	 }
  
	 /**
	 * Get the XML contents and parse like SimpleXML
	 *
	 * @[member='param'] string $file
	 * @[member='param'] string $resulttype
	 * @[member='param'] string $encoding
	 * @[member='Return'] array/object
	 */
	 function xml_load_file($file, $resulttype = 'object', $encoding = 'UTF-8')
	 {
	
	  $php_errormsg="";
	  $this->result="";
	  $this->evalCode="";
	  $values="";
	
	  $data = $this->curl_get_file_contents($file);
  
	  if (!$data){
	   return 'Cannot open xml document: ' . (isset($php_errormsg) ? $php_errormsg : $file);
	  }
  
	  $parser = xml_parser_create($encoding);
	  xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
	  xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
	  $ok = xml_parse_into_struct($parser, $data, $values);
	  if (!$ok) {
	   $errmsg = sprintf("XML parse error %d '%s' at line %d, column %d (byte index %d)",
	   xml_get_error_code($parser),
	   xml_error_string(xml_get_error_code($parser)),
	   xml_get_current_line_number($parser),
	   xml_get_current_column_number($parser),
	   xml_get_current_byte_index($parser));
	  }
	  xml_parser_free($parser);
	  if (!$ok)
	  return $errmsg;
	  if ($resulttype == 'array')
	  return $this->xml_reorganize($values);
	  // default $resulttype is 'object'
	  return $this->array2object($this->xml_reorganize($values));
	 }
	  
	 function xml_load_string($string, $resulttype = 'object', $encoding = 'UTF-8')
	 {
	
	  $php_errormsg="";
	  $this->result="";
	  $this->evalCode="";
	  $values="";
	
	  $data = $string;
  
	  if (!$data){
	   return 'Cannot open xml document: ' . (isset($php_errormsg) ? $php_errormsg : $file);
	  }
  
	  $parser = xml_parser_create($encoding);
	  xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
	  xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
	  $ok = xml_parse_into_struct($parser, $data, $values);
	  if (!$ok) {
	   $errmsg = sprintf("XML parse error %d '%s' at line %d, column %d (byte index %d)",
	   xml_get_error_code($parser),
	   xml_error_string(xml_get_error_code($parser)),
	   xml_get_current_line_number($parser),
	   xml_get_current_column_number($parser),
	   xml_get_current_byte_index($parser));
	  }
	  xml_parser_free($parser);
	  if (!$ok)
	  return $errmsg;
	  if ($resulttype == 'array')
	  return $this->xml_reorganize($values);
	  // default $resulttype is 'object'
	  return $this->array2object($this->xml_reorganize($values));
	 }
	}
}

Edited by TpEnEpETE, 10 June 2012 - 06:57.


#259   greasemonkey

greasemonkey
  • Members
  • 407 posts
  • Real Name:Scott
  • Gender:Male

Posted 11 June 2012 - 13:54

Hi All,

Regarding Automated FedEX labels:

1. I Installed FedEx - Web Services v9 for real time quotes. Now I'm back with quotes. So far so good.

2. Change production server reference in fedexdc.php, and the above replacement suggestions by Joel.

But all I get is a broken "Astra Barcode."

Hope this motivates someone.


After chasing my tail all day Friday I left this over the weekend... and came back this morning to start fresh, reloaded my orginal back up's of fedexdc and ship_fedex... and guess what.... Its working??????????????? No changes from the orginal????

It would seem Fedex has put the old API back online. For now.... So I have the org realtime quotes installed, but deactivated, with the org meter number.

I'm sure this is temporary, so I'm going to still work towards a webservices solution.

#260   lifeisboost

lifeisboost
  • Members
  • 86 posts
  • Real Name:Peter

Posted 11 June 2012 - 15:08

I have recoded fedex labels to work with the new system if anyone needs help you can PM me.