Title: Localhost error &amp; write error
Last modified: August 31, 2016

---

# Localhost error & write error

 *  [Simon J.](https://wordpress.org/support/users/simon-j-1/)
 * (@simon-j-1)
 * [10 years ago](https://wordpress.org/support/topic/localhost-error-write-error/)
 * Moro, Antti!
 * I noticed somebody else has had this problem too. It would really help, if your
   plugin had the fallback option to use something else than localhost as a fail
   safe, because I had to edit the source code to make it work. Unfortunately I 
   didn’t choose the host, so there is nothing I can do about it.
 * Also the host I’m stuck with in this particular instance seems to be allergic
   to special characters in the file name. I’m not sure which ones. Therefore I 
   think it would be better to generate the file name for the PDF using the slug
   instead of the title.
 * [https://wordpress.org/plugins/wp-pdf-templates/](https://wordpress.org/plugins/wp-pdf-templates/)

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

 *  Plugin Author [Viljami Kuosmanen](https://wordpress.org/support/users/zuige/)
 * (@zuige)
 * [10 years ago](https://wordpress.org/support/topic/localhost-error-write-error/#post-7301950)
 * There already is a fallback. See this part of the code:
 *     ```
       if( empty( $html ) ) {
               // if all else fails, try the public site url (not localhost)
               $link = get_the_permalink();
               $link = $link . (strpos($link, '?') === false ? '?' : '&') . 'pdf-template';
               $html = file_get_contents( $link , false, $context );
             }
       ```
   
 * Why do you think this doesn’t work?
 *  [AleksiBMM](https://wordpress.org/support/users/alluxus/)
 * (@alluxus)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/localhost-error-write-error/#post-8362980)
 * Hi Antti,
 * I think I’m having the same problem as Simon.
 * I’m getting following warnings on this site: [http://viikinhelmi.fi/lounaat/vko-43/pdf/](http://viikinhelmi.fi/lounaat/vko-43/pdf/)
 * > Warning: file_get_contents([http://localhost/lounaat/vko-43/?pdf-template](http://localhost/lounaat/vko-43/?pdf-template)):
   > failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/
   > www/customers/viikinhelmifi/public_html/wp-content/plugins/wp-pdf-templates/
   > wp-pdf-templates.php on line 243
   > Warning: file_get_contents([http://localhost/lounaat/vko-43/?pdf-template](http://localhost/lounaat/vko-43/?pdf-template)):
   > failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/
   > www/customers/viikinhelmifi/public_html/wp-content/plugins/wp-pdf-templates/
   > wp-pdf-templates.php on line 247
 * Can you help me with this one?

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

The topic ‘Localhost error & write error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-pdf-templates_ffffff.svg)
 * [WordPress PDF Templates](https://wordpress.org/plugins/wp-pdf-templates/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-pdf-templates/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-pdf-templates/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-pdf-templates/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-pdf-templates/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-pdf-templates/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [AleksiBMM](https://wordpress.org/support/users/alluxus/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/localhost-error-write-error/#post-8362980)
 * Status: not resolved