Re: Two websites need to share part of one database, suggestions please

From: Date: Mon, 11 Jul 2005 22:07:45 +0000
Subject: Re: Two websites need to share part of one database, suggestions please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-218498@lists.php.net to get a copy of this message
XML is quite easy. Let's say you're making a search for books, and you have site1.com searching site2.com for some stuff. site2.com could have some sort of "back end" like http://site2.com/_backend/search.php?keywords=a+book That would search it's database for the keywords "a book". It could generate XML like: <searchResults> <searchResult> <id>1</id> <bookTitle>A Children's Book</bookTitle> </searchResult> <searchResult> <id>2</id> <bookTitle>A Book about Everything!</bookTitle> </searchResult> </searchResults> To do this request, PHP has the fopen command, that will allow you to read from URLs too (see http://pt.php.net/fopen). After reading the XML code into a string, just parse it. There are hundreds of classes on phpclasses.org. Just take a pick :) I hope this was helpful. If you need me to explain something more thoroughly, let me know. Good luck :) On 7/11/05, Chris W. Parker <cparker@swatgear.com> wrote: > André Medeiros <mailto:andre.caum@gmail.com> > on Monday, July 11, 2005 12:44 PM said: > > > What about using web-services (something ala xml?). Could that be > > considered an option? > > No because I don't how to use that stuff. :) > > > Chris. >

« previous php.general (#218498) next »