Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Viljami Kuosmanen

    (@zuige)

    There’s no workaround as of yet, but we sure would like to include one in the project! I’ve never encountered this limitation myself, so there hasn’t really been a need for one.

    I do admit however that using file_get_contents is inherently ugly, and initially we did want to avoid its use. There didn’t seem to be a simple non-hacky way to completely render a WordPress post from template and store it in a separate output buffer without initiating a complete request heap. Simplest way to do this is via a http request to WordPress.

    You could always create a curl implementation, to circumvent the missing file_get_contents issue. This would be very welcome.

    Feel free to pull-request us with a patch on GitHub!
    https://github.com/Seravo/wp-pdf-templates

    I’m keeping this thread open for further discussion.

    Thread Starter Brian Daley

    (@bdaley)

    Yeah, don’t get me wrong. The use of file_get_contents() makes perfect sense. You need to get the rendered HTML from WordPress. file_get_contents() is dead-simple and it works. I’ve just had certain hosts block that function when trying to fetch over HTTP.

    Hopefully I’ll have some time to submit a pull request. I’ll have to make the modification for my server anyway.

    Thanks for the quick response. This is a great plugin.

    -Brian

    Plugin Author Viljami Kuosmanen

    (@zuige)

    A pull request with a patch would be very appreciated! Please do submit one if you find the time. I’ll be sure to merge and update the plugin with your patch so that your changes are retained for future updates.

    Thanks for trying out our plugin,

    Cheers!

    I have just run into this problem after the latest update to WordPress 4.2.3. I mean, both the pdf and pdf-preview refuses to load and the server times out and shows Warning: file_get_contents(https://www.domain.com/mypage/?pdf-template): failed to open stream: HTTP request failed! in /?ink/to/content/wp-content/plugins/wp-pdf-templates/wp-pdf-templates.php on line 227

    It worked perfectly before the update, and I have checked my phpinfo and nothing has changed on the server. No new plugins installed either. It just stopped.

    Any ideas as to why this is?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘fopen wrappers and file_get_contents()’ is closed to new replies.