Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder levani's Avatar
    Join Date
    Mar 2009
    Location
    Georgia
    Posts
    183
    Thanks
    29
    Thanked 1 Time in 1 Post

    Transfer data between two sites

    Hello,

    I have one question... How can I transfer data between two sites? I would like to display latest posts from my site to other websites. When I add new article to my site it should automatically display on these sites.

    Is that possible using php?

    The most important thing is that I don't want to allow everyone to display my news. I should be able to manage which websites can use my news ticker...

    Thanks in advance

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    I'd make a post request to the parent site using curl, caching the data for a specific period of time depending on how often the data will be updated so you're not making the request every time the page is loaded. Within the post request, include a pre-specified "secret key", some string of text that only you know that is required to display the data. Included in the post request could be data that is able to alter what type of info is presented.

    Before presenting the data on the parent site, serialize it. Then on the receiving site: unserialize it, cache it, and do whatever you want with it. This is basically how most web application APIs function.

    Serialization is one of numerous was to present it. It could be CSV-formatted, XML, etc. Serialization is probably the most convenient though as all you have to do is pass it through unserialize() and not only is the data received, but the types as well.
    Last edited by kbluhm; 02-13-2010 at 06:09 PM.

  • #3
    Regular Coder
    Join Date
    Jan 2010
    Posts
    101
    Thanks
    17
    Thanked 5 Times in 5 Posts
    I believe you're looking for remote database control. Some web hosts offer it, but not all. If you're using PHP + MySQL or something, you can set up the database configuration in PHP so that it connects to a remote server (this config can be uploaded to any server and be able to connect to the remote server if your host permits it).

  • #4
    Regular Coder levani's Avatar
    Join Date
    Mar 2009
    Location
    Georgia
    Posts
    183
    Thanks
    29
    Thanked 1 Time in 1 Post
    It looks rather complicated than I thought... Is there any tutorial or example of code available on the internet?


  •  

    Posting Permissions

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