Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
Thread: Transfer data between two sites
02-13-2010, 12:35 PM #1
Transfer data between two sites
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 #2
- Join Date
- Apr 2007
- Philadelphia, PA, USA
- 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.
02-15-2010, 08:47 AM #3
- Join Date
- Jan 2010
- 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).
02-16-2010, 10:26 AM #4