Skip navigation and move to Contents...
Bible 2.0 Scripture explains itself Bible 2.0

Update: The Word Widget 0.4 for WordPress – More Compatible

Version 0.4 also works on servers that restrict retrieval of data from other websites.

Download on wordpress.org: The Word Widget

Description on bible2.net: The Word Widget for WordPress

About Version 0.4

Some website hosters limit the ways that pages on their site can fetch data from other websites. This caused The Word Widget up to version 0.3 to fail on such servers. Sorry for inconvenience!

Strange enough, there are several ways of doing the same thing. WordPress itself uses one of the alternative methods that are (obviously) not affected by the typical server limitations. The Word Widget version 0.4 also tries it "the Wordpress way", therefore it works even on servers with limited access to other websites.

The technical details

Some hosters turn the PHP setting allow_url_fopen off. This causes the simplexml_load_file PHP function to fail, which The Word Widget used to get the XML list of Bible editions available on bible2.net.

Some people recommend to overwrite this setting in a file php.ini placed in the plug-in directory. But according with the PHP docs, this does not work, because allow_url_fopen can be modified only on system level (PHP_INI_SYSTEM).

I found many discussions about using the curl functions instead. While these provide very detailed control over the data retrieval, there is still another function: wp_remote_get, which is provided by WordPress (as you see from the "wp" prefix). Actually, The Word Widget already used this function to retrieve the daily verses. It was a small change to fetch the XML list of Bible editions using wp_remote_get, in case the simplexml_load_file function fails. simplexml_load_string then provides the same data structure than the first try by simplexml_load_file.

2014-12-23 • HSteeb • updated 2014-12-30