Wordpress Recent Post From Another Site

Discussion in 'Web Design and Development' started by jdl8422, Nov 5, 2008.

  1. jdl8422 macrumors 6502

    jdl8422

    Joined:
    Jul 5, 2006
    Location:
    Louisiana
    #1
    I am designing a site for myself and in the footer I want to have a recent post list. The thing is I want to have the recent post from another website of mine. Both websites are going to be on my server. So is it possible to have recent post from my a site go to another site? They are both going to be wordpress, but one is more of a blog and one will be a portfolio site. I'm pretty sure I can use a RSS feed and feed burner but I didnt want to. Thanks for your help
     
  2. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #2
    From a professional perspective, here are two common ways information is exchanged securely and in real time between two or more sites AND avoid proprietary code:

    1) An API (advanced programming interface) using XML-RPC
    2) XML (such as an RSS newsfeed) <-- I suggest this for non-developers

    Proprietary means both sides use a custom solution, non-standardized, which is fine until one side makes a change or needs enhancements.

    You could ask the other webmaster to create an API using the XML-RPC method. You (the client) connect and pass request data to them (the server) with XML being used both ways for the transaction. This means you can use whatever software language/framework you want for the client and the webmaster on the other side can use whatever they want as well. RPC stands for remote procedure call, the method by which data is sent between the client and the server. An example API might be eBay which allows you to connect to its server passing your account ID, item ID and other information and it returns data containing all current bidding activity for that auction. All modern web languages have frameworks for setting up either the client or server side API.

    XML-RPC tutorial
    Here is a PHP framework for XML-RPC (API) for example.

    I'd suggest the RSS, of course, as RSS is nothing more than a standardized form of XML. This means, like in the API method, both sides use your own software to process the transaction, it's super easy to implement RSS these days so its the obvious choice for most needs. Or consider an API if you both agree you need customization, dynamic queries of data, and a more "private" direct exchange of data. Unlike RSS, XML-RPC allows for encryption and even license keys if applicable.

    -jim
     
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    @SrWebDeveloper: Is all that necessary since he owns both sites and they are on the same server? I haven't messed with this type of thing so not sure myself, but your write-up made it sound like you thought the other site was owned by someone else. Just want to make sure for the OP's sake. Though. just accessing a RSS XML file would be the same type of solution no matter where the other web site is hosted.
     
  4. wordmunger macrumors 603

    wordmunger

    Joined:
    Sep 3, 2003
    Location:
    North Carolina
    #4
    I'm pretty sure there are wordpress widgets that can do this -- I suggest searching the wordpress forums.
     
  5. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #5
    On the same server?! Uh, I guess I missed that important part, heh. :eek:

    Let me try this one more time!

    Beyond a widget someone already wrote, the next thing to try might be (concept, not code):

    Write a no frills PHP script on your portfolio site that queries the Wordpress database/tables for the recent post and displays the results in HTML format. Simply include this script in the footer of your portfolio site where you want the recent post info to display. If MySQL is running on the server for both sites use phpMyAdmin or the mysqladmin via shell to create a special user and password on your portfolio site to access the Wordpress database and ONLY the specific tables used in your query. In MySQL 4.1 or later permissions setup you can assign a user to table specific privileges and also disable insert/update/delete and so on for extra security. This is strongly suggested even if not required, regardless if localhost or remote MySQL access.

    If you can't find a widget and want to try the above solution, sorry, I don't run Wordpress so I can't tell you what query to use and which tables are involved. That would be your next question to the people browsing this topic or maybe post it on one of the Wordpress widget/hack sites.

    Beyond this, I have other suggestions (exporting from blog site to a cached flat file for import by portfolio site, and browsing the blog site via PHP's fopen() to parse the target HTML) but these are more complex.

    -jim
     
  6. jdl8422 thread starter macrumors 6502

    jdl8422

    Joined:
    Jul 5, 2006
    Location:
    Louisiana
    #6
    @ SrWebDeveloper

    Thank you for your in depth answers. I really appreciate the time you took to write the responses. I also respect your knowledge of the web. Thanks again.
     
  7. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #7
    No problem, they're treating me for dyslexia my. :D

    Seriously, I can't help you with the WP query, but I can informally help you with the rest in terms of PHP code and MySQL if no WP widgets exist out there so you don't need to reinvent the wheel. Best of success to ya on the project. Cheers.

    -jim
     

Share This Page