View Full Version : Transfer data between two sites
02-13-2010, 12:35 PM
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
02-13-2010, 01:07 PM
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.
02-15-2010, 08:47 AM
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).
02-16-2010, 10:26 AM
It looks rather complicated than I thought... Is there any tutorial or example of code available on the internet?
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.