Brian Murphy wrote:
I have a php-based yahoo-like web directory.I wanna give webmasters
the possiblity to integrate my whole directory in their websites with
their own formatting.I wanna this inclusion to be possible to all
kinds of websites (ASP,PHP,... or just HTML).There are basically two
files in my website:
-index.php : shows the main categories along with 3 sample
subcategories.
-index1.php : displays the subcategories and sites of categories
(exactly like yahoo!).
I wanna make possible the browsing of the categories from those
websites.The user shouldn't notice this content comes from
outside.However, I wanna be able to know how many users used my
directory from those websites.Any help will be
welcome!
Welcome to the wonderful world of Web services!
If I understood your requirements correctly, you wish to a) send just the
data, so that the other site is able to format it in any manner, and b) to
be able to send different data according to the input from the website (eg.
if a visitor to the other site browses your directory, that site sends you a
different query for each directory).
The best way to do that is using XML. Make a PHP script which creates XML
output, based on the query -- just like you would make a PHP->HTML page,
only the data is formatted as XML. The exact format of the format of the
request and the response can be done in either of this three ways (ordered
by increasing universality and standards-compliance, and decreasing
complexity).
1. SOAP: The industry standard for Web services, as defined by W3C and other
bodies. However, it is so complex that I wouldn't recommend it for a company
any smaller than NASA or IBM.
2. XML-RPC: A "guerilla" Web services standard, originally designed by
Userland. A number of client and server implementations for various
platforms are available, and you can read all about it at
http://www.xmlrpc.org/
3. DYOWS, or 'do your own Web service': Basically, you create whatever XML
vocabulary best fits your data and then give each of your 'customers' (the
sites that use your service) brief instructions how to query the data and
what the result contain. The disadvantage of this approach is that you have
to tech your customers, while in other cases you just point them to the
service's URL, say them 'it uses XML-RPC' and let them think about it from
then on. However, for smaller services everything else might just be an
overkill, and this might be the best approach.
I'll let you decide what would be the best solution for you, although I
believe thae the choice will be between the last two options above.
Berislav