Page 2 of 2 FirstFirst 12
Results 11 to 11 of 11

Thread: How Can I Use a Include File With This Functions.php Code Snippet?

  1. #11
    Ryan's Avatar
    Ryan is offline WordPress Legend
    Join Date
    Jan 2009
    Location
    New Zealand
    Posts
    2,801

    Default

    PHP Code:
    AlsoI didnt even know about wp_remote_retrieve_bodySeriously
    It seems that neither did the Akismet guys until an update was made to the plugin a few days back.

    Jacob Santos told me use it once when I was whining via Skype about how some people couldn't get a plugin of mine to work due to their server setups not accepting the http request. As soon as I switched to the built in http API everything worked seamlessly :) There was very little documentation available at the time, but I've noticed a few blog posts about it here and there since then so should be a bit easier to figure out now (I only nutted it out with the help of Jacob himself).



    I went fishing around in some old code of mine and pulled this up. It should allow you to grab the page contents of the URL as a string from wherever you want. If you need to parse that as PHP you would need to use eval(). If you can sanitize it beforehand that would probably be a good idea as passing PHP directly between servers like that doesn't seem like a good idea to me due to the potential of some prat intercepting it enroute.
    PHP Code:
    <?php $string wp_remote_retrieve_bodywp_remote_get$url ) ); ?>

    EDIT: I went looking for more resources on this, but it seems there are still aren't very many. Ozh wrote an article, but it uses the class directly rather than making use of the wrapper functions which handle all the complex bits for you ... http://planetozh.com/blog/2009/08/ho...ith-wordpress/
    Last edited by Ryan; 12-18-2010 at 05:34 PM.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •