Updated STW PHP Sample Code (v2.0.7) released

3 posts / 0 new
Last post
puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

It has come to our attention that the v2.0.1 through v2.0.4 versions of STW PHP Sample Code do not properly account for a missing XML response (i.e. account banned/inactive, certain types of bad requests, service offline for maintenance, or something wrong with the service itself) and can result in a Fatal PHP error. This can cause the following error output:

WARNING: DOMDocument::loadXML() [domdocument.loadxml]: Start tag expected, '<' not found in Entity

I have just updated the STW PHP Sample Code (now v2.0.6) with a fix for this issue. The fix is:

In the Account API and Sample Code functions, replace

	        $oDOM->loadXML($sResponse);

With:

	        if(strpos($sResponse,'<')){$oDOM->loadXML($sResponse);} // Avoid Fatal XML errors if not valid XML or no response
		else{return FALSE;}

This release also adds some notes about not loading the Account API on every page load or screenshot display (only ONCE when loading or saving a configuration page).

I also added some updates to support PDF integration for those interested in the URL-to-PDF feature. Since there were quite a few changes, across several of the functions, I have incremented the version to v2.0.7 for tracking and troubleshooting purposes (in case there are issues with that new revision).

You may download the latest STW PHP Sample Code and changelog from the STW Documentation area.

jvext's picture
jvext
Offline
Joined: 08/30/2008
Visit jvext's Website

I downloaded the sample php zip and find that it is still showing up VER as 2.0.5 in the file. Can you double check the zip file please.

Thanks
Niranjan

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

Hi Niranjan,

Drupal didn't notify me of your post. Sorry, just now seeing it.

I checked the zip when I updated it and I just now checked it again. The main zip is v2.0.7 (just confirmed again) and I added a link to the v2.0.6 version as well on the documentation page. I made sure to upload to all of the web nodes, so the file should be the same on all of them.

Please try again and let me know if you still have issues.

Thanks,

Brandon

ShrinkTheWeb® (About STW) is another innovation by Neosys Consulting
Contact Us | PagePix Benefits | Learn More | STW Forums | Our Partners | Privacy Policy | Terms of Use

Announcing Javvy, the best crypto exchange and wallet solution (coming soon!)

©2018 ShrinkTheWeb. All rights reserved. ShrinkTheWeb is a registered trademark of ShrinkTheWeb.