Title: Trying to convert php library from github to wordpress plugin.
Last modified: November 8, 2017

---

# Trying to convert php library from github to wordpress plugin.

 *  [samuelalake](https://wordpress.org/support/users/samuelalake/)
 * (@samuelalake)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/trying-to-convert-php-library-from-github-to-wordpress-plugin/)
 * I’m a newbie learning php and I’ve been trying to convert the zip file of a php
   library that I found on github to a wordpress plugin.
 * But i dont understand what this line means.
 * “Call RecipeParser::parse(), passing in the contents of an HTML file that includes
   a recipe and, optionally, the URL of the original page, which helps to identify
   specific parsers to use.”
 * Where do I call that code and automatically pass in content for html and different
   url. Is there a function that I’m missing?
 * I want the plugin to automatically create a new blog post of parsed recipes every
   time a content is published on certain websites. Is this even possible
 * This is the guthub link. [https://github.com/onetsp/RecipeParser/blob/master/README.md](https://github.com/onetsp/RecipeParser/blob/master/README.md).
   Thank you in advance.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftrying-to-convert-php-library-from-github-to-wordpress-plugin%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/trying-to-convert-php-library-from-github-to-wordpress-plugin/#post-9663988)
 * You’d call RecipeParser::parse() when you are creating the post content for your
   new post as a result of something being published on another site. The URL would
   be whatever is used to get the remote content — the permalink. The HTML would
   be what ever the response is after requesting that permalink.
 * The big question is how does your code know when new content is published on 
   a remote site? It depends on the site. If it has a RSS feed, you can check that.
   If it’s a site with a REST API like WP, you could periodically query for recent
   posts. If it’s another site you control, the remote site could actually add posts
   to your site through your site’s own REST API, provided the authentication can
   be worked out.
 *  Thread Starter [samuelalake](https://wordpress.org/support/users/samuelalake/)
 * (@samuelalake)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/trying-to-convert-php-library-from-github-to-wordpress-plugin/#post-9665417)
 * Thanks for the feedback. I’m planning on using rss feed. Do you think there is
   any ready made rss php that comes with a plugin menu so I can use submit feed
   and then pass the content to RecipeParser::parse(). Ive been having a hard time
   trying to create one myself and I’ve tried using Simplepie.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/trying-to-convert-php-library-from-github-to-wordpress-plugin/#post-9667138)
 * Sorry, I’m not the best person to ask about what’s available. Frankly, RSS sounds
   like a pain to me, unless you can control the outgoing feed as well. You don’t
   really know what you’re going to get. Then you need to coordinate the output 
   with posts you’ve already retrieved. If you don’t do so often enough, posts could
   drop off the end without your app seeing them.
 * I’d be inclined to use the REST API. You can query for posts that were published
   after a certain date/time. You’ll only get what you need. It’ll come in JSON 
   format, which is generally easier to deal with. I don’t know how the recipe parser
   would deal with JSON, it may be fine. You can always extract the content for 
   it if need be.
 * It’s not my place to tell you what to do, but that’s what I would do 🙂
 *  Thread Starter [samuelalake](https://wordpress.org/support/users/samuelalake/)
 * (@samuelalake)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/trying-to-convert-php-library-from-github-to-wordpress-plugin/#post-9668360)
 * It doesnt necessarily need to be RSS. I just need something that can automatically
   fetch the html file and url of a content so I can pass it to the Recipe Parser.
   Read [https://github.com/onetsp/RecipeParser/blob/master/README.md](https://github.com/onetsp/RecipeParser/blob/master/README.md).
   What do I do? Will php Curl work?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/trying-to-convert-php-library-from-github-to-wordpress-plugin/#post-9670979)
 * If cURL is available on your server, then yes, that’s a good choice. Consider
   using the [REST API](https://developer.wordpress.org/rest-api/reference/posts/#list-posts)
   for getting the content you need. The link is to the specific request parameters
   you can use. Of particular interest is “after”. You can keep track of when the
   last post was received, and periodically get posts after that date. If you’re
   not familiar with this API, you’ll want to review the rest of the Handbook into
   which I’ve linked.
 * I’ve been assuming the external sources of recipes to parse are also WP sites.
   If not, then RSS feeds might be your only choice unless other CMS platforms also
   have a REST API. I’m not sure how widely supported REST is. Another possibility
   is [XML-RPC](https://codex.wordpress.org/XML-RPC_WordPress_API).

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

The topic ‘Trying to convert php library from github to wordpress plugin.’ is closed
to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [RSS](https://wordpress.org/support/topic-tag/rss/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 5 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/trying-to-convert-php-library-from-github-to-wordpress-plugin/#post-9670979)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
