Title: Error simplexml_load_file on shared hosting
Last modified: August 21, 2016

---

# Error simplexml_load_file on shared hosting

 *  Resolved [Walter Bishop](https://wordpress.org/support/users/walter-bishop/)
 * (@walter-bishop)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/)
 * Hello,
    I am getting the simplexml_load_file error. I researched it and found
   the allow_url_fopen directive fix, but I am using shared hosting and cannot change
   my PHP directives. The webdev experts I read from claimed that using curl instead
   would fix this problem, and also that using fopen to pull in external files was
   not secure and that curl should be used instead anyway.
 * Could you change your code to use curl instead, to better support shared hosting
   users? Or perhaps send the required code changes to me at least? I could not 
   figure out how to code all those changes myself.
 * Thank you for your time
 * [https://wordpress.org/plugins/wp-cloudy/](https://wordpress.org/plugins/wp-cloudy/)

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617769)
 * Hi,
    can you post a screenshot of your problem please?
 * Thank you
 *  [kevin9027](https://wordpress.org/support/users/kevin9027/)
 * (@kevin9027)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617822)
 * Got into the office this morning with an error on one of our sites concerning
   simplexml_load_file too. It was working fine last week. There weren’t any changes
   made to the server and it is still working fine on the dev server.
 * Here’s the error:
 * > Warning: simplexml_load_file(): [http://api.openweathermap.org/data/2.5/forecast?q=Grand%20Haven%2C%20MI%2Cusa&mode=xml&units=imperial&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=en:1](http://api.openweathermap.org/data/2.5/forecast?q=Grand%20Haven%2C%20MI%2Cusa&mode=xml&units=imperial&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=en:1):
   > parser error : Start tag expected, ‘<‘ not found in /var/www/vhost/ourdomain.
   > org/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1390 Warning:
   > simplexml_load_file(): {“message”:””,”cod”:”404″} in /var/www/vhost/ourdomain.
   > org/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1390 Warning:
   > simplexml_load_file(): ^ in /var/www/vhost/ourdomain.org/public_html/wp-content/
   > plugins/wp-cloudy/wpcloudy.php on line 1390
 *  [kevin9027](https://wordpress.org/support/users/kevin9027/)
 * (@kevin9027)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617823)
 * Okay. So, it appears your service was unavailable this morning (and apparently
   part of yesterday too).
    Since having your service go down and send back a 404
   throws a GIANT error on the page, I think we’ll have to discontinue using it.
   Not having a temp, or missing some of the info is one thing, but a wall of error
   text on an api 404 isn’t something we can have. If you have a way to get around
   this, please let me know.
 * Thank you for your time and efforts on a great looking plugin.
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617871)
 * Hi,
    this error happens when openweathermap.org (the service that provides weather)
   doesn’t load. Free version provides availability from 95% to 99,5%. ([http://openweathermap.com/price](http://openweathermap.com/price))
 * However, I am currently developing a caching system to avoid such problems and
   gain speed.
 * Thanks.
 *  [kevin9027](https://wordpress.org/support/users/kevin9027/)
 * (@kevin9027)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617872)
 * thanks for the reply.
    even just a message that’s editable in the php or something
   whenever there isn’t a response. It never occurred to us that having the weather
   service down would throw a wall of error code on our client’s homepage, because
   all weather service apis are unavailable from time to time.
 * At any rate, it looks great. Clean and sexy.
    Thanks.
 *  [scald](https://wordpress.org/support/users/scald/)
 * (@scald)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617887)
 * I came across this error after exporting an existing site to a new multisite 
   environment. The reason I got the error was because my short code referred to
   the ID of the Weather post from the old environment, but when I imported the 
   posts, the ID’s were changed.
 *  [Mr Press](https://wordpress.org/support/users/tahrirsquare/)
 * (@tahrirsquare)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617898)
 * If problems persist you can use cURL, which is a better idea anyway. Replace 
   the following lines in wpcloudy.php:
 *     ```
       $myweather = simplexml_load_file("http://api.openweathermap.org/data/2.5/forecast?q=$wpcloudy_city,$wpcloudy_country_code&mode=xml&units=$wpcloudy_unit&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=$wpcloudy_lang_owm");
       $myweather_sevendays = simplexml_load_file("http://api.openweathermap.org/data/2.5/forecast/daily?q=$wpcloudy_city,$wpcloudy_country_code&mode=xml&units=$wpcloudy_unit&cnt=7&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=$wpcloudy_lang_owm");
       ```
   
 * with:
 *     ```
       $path = "http://api.openweathermap.org/data/2.5/forecast?q=$wpcloudy_city,$wpcloudy_country_code&mode=xml&units=$wpcloudy_unit&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=$wpcloudy_lang_owm";
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $path);
         curl_setopt($ch, CURLOPT_FAILONERROR, 1);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_TIMEOUT, 15);
         $returned = curl_exec($ch);
         curl_close($ch);
         $myweather = simplexml_load_string($returned);
   
         $path = "http://api.openweathermap.org/data/2.5/forecast/daily?q=$wpcloudy_city,$wpcloudy_country_code&mode=xml&units=$wpcloudy_unit&cnt=7&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=$wpcloudy_lang_owm";
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $path);
         curl_setopt($ch, CURLOPT_FAILONERROR, 1);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_TIMEOUT, 15);
         $returned = curl_exec($ch);
         curl_close($ch);
         $myweather_sevendays = simplexml_load_string($returned);
       ```
   
 * This is tested up to plugin version 2.4 I think but should work fine.
 *  Thread Starter [Walter Bishop](https://wordpress.org/support/users/walter-bishop/)
 * (@walter-bishop)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617899)
 * This is the error I am receiving. Mr Press’s code made the errors disappear, 
   but did not make the weather download. I updated to 2.6.2 but it is still broken.
   Same error, and it puts every temperature at 0.
 *     ```
       Warning: simplexml_load_file(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/escapeto/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1725
   
       Warning: simplexml_load_file(http://api.openweathermap.org/data/2.5/weather?q=Manta,Ecuador&mode=xml&units=metric&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=en): failed to open stream: no suitable wrapper could be found in /home/escapeto/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1725
   
       Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://api.openweathermap.org/data/2.5/weather?q=Manta,Ecuador&mode=xml&units=metric&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=en" in /home/escapeto/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1725
   
       Warning: simplexml_load_file(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/escapeto/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1727
   
       Warning: simplexml_load_file(http://api.openweathermap.org/data/2.5/forecast/weather?q=Manta,Ecuador&mode=xml&units=metric&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=en): failed to open stream: no suitable wrapper could be found in /home/escapeto/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1727
   
       Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://api.openweathermap.org/data/2.5/forecast/weather?q=Manta,Ecuador&mode=xml&units=metric&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=en" in /home/escapeto/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1727
   
       Warning: simplexml_load_file(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/escapeto/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1735
   
       Warning: simplexml_load_file(http://api.openweathermap.org/data/2.5/forecast/daily?q=Manta,Ecuador&mode=xml&units=metric&cnt=7&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=en&cnt=14): failed to open stream: no suitable wrapper could be found in /home/escapeto/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1735
   
       Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://api.openweathermap.org/data/2.5/forecast/daily?q=Manta,Ecuador&mode=xml&units=metric&cnt=7&APPID=46c433f6ba7dd4d29d5718dac3d7f035&lang=en&cnt=14" in /home/escapeto/public_html/wp-content/plugins/wp-cloudy/wpcloudy.php on line 1735
       ```
   
 *  [Mr Press](https://wordpress.org/support/users/tahrirsquare/)
 * (@tahrirsquare)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617900)
 * [@walter](https://wordpress.org/support/users/walter/) put this line after the
   code I provided in wpcloudy.php:
 * `var_dump($myweather);`
 * Does it show any weather data values when you load a page with your weather shortcode?
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617912)
 * If you upgrade to the latest release (v2.6.3), xml errors will now be hidden 
   if Open Weather Map is down.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Error simplexml_load_file on shared hosting’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-cloudy_657583.svg)
 * [WP Cloudy](https://wordpress.org/plugins/wp-cloudy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cloudy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cloudy/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cloudy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cloudy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cloudy/reviews/)

## Tags

 * [allow_url_fopen()](https://wordpress.org/support/topic-tag/allow_url_fopen/)
 * [external](https://wordpress.org/support/topic-tag/external/)
 * [fopen](https://wordpress.org/support/topic-tag/fopen/)
 * [shared](https://wordpress.org/support/topic-tag/shared/)
 * [simplexml_load_file](https://wordpress.org/support/topic-tag/simplexml_load_file/)
 * [xml](https://wordpress.org/support/topic-tag/xml/)

 * 10 replies
 * 5 participants
 * Last reply from: [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/error-simplexml_load_file-on-shared-hosting/#post-4617912)
 * Status: resolved