469,352 Members | 1,697 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

How to display a website content on another

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!
Jul 17 '05 #1
4 13094
"Brian Murphy" <ya******@yahoo.com> wrote in message
news:c3**************************@posting.google.c om...
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!

Well if you want total integration, don't botther with making a page, but
rather having data available via php to others so they can use it.

An example, lets say you have 4 catagories, so they call a file on your
server

getCat.php
----------
<?
header("Content-type: text/plain");
print "Cat-name-1\n";
print "Cat-name-2\n";
print "Cat-name-3\n";
print "Cat-name-4\n";
?>
so when the query your site, they will have the 4 cat names, then it up to
them to display it in thier site as they wish.

I use this with weather.com, I have a script that gets the weather info from
weather.com, but it is an an xml format and I show the data, after I parse
it out, on a page I create.
--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #2
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!


If I understood you correctly, I'd do a page to download the categories
and links with various formats.
Something like
download.php?format=html&categories=all
or download.php?format=csv&categories=php%2casp
or download.php?format=php&categories=html
....

Then download.php outputs the requested categories in the requested
format (maybe you should validate the requester first -- IP, cookie, add
a pwd to the URL, ...), and logs the request.

Of course, the requester may download the data once per week, but have
it viewed (more and more out-of-date) several times per day; you have no
way to force them to always use the more recent data.
If they request the format=html, with php, they'd do
include('http://www.yourdomain.com/download.php?format=html');
and have the data presented to their users the way you format it for
html;

with a request of format=csv, they'd get the data into a string and
parse and display it (or save into _their_ database), for example, they
might receive
"php","http://www.php.net/","The source for php data."
"asp","http://www.microsoft.com/","ASP at it's source."

with a request of format=php (my favourite!) they'd get the result of
your command:
<?php echo serialize($data_array); ?>
and they just do
<?php
$brian_data = unserialize(file_get_contents('http://www.yourdomain.com/download.php?format=php'));
?>
to have your data neatly packed into their $brian_data array :)

Hope I made sense,

Happy Coding!
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #3
That's what frames are for. If you want the content to appear in the page
itself, you would need to write a page that places the content in a
Javascript string, have the website link in that page and dynamically write
the content where they want it to appear.

Snippet to be inserted into their pages:

<script src="http://somewhere.com/content.js.php"></script>
<script> document.write(content_from_somewhere_dot_com); </script>

content.js.php:

<?php

// get the page
$html = file_get_contents("http://localhost/index.php");

// get the content inside the document body
if(preg_match('/<body.*?>(.*)<\\/body>/si', $html, $matches)) {
$content = $matches[1];
$js_str = addcslashes($content, "\\\r\n\t'");
echo "var content_from_somewhere_dot_com = '$js_str';";
}

?>

Uzytkownik "Brian Murphy" <ya******@yahoo.com> napisal w wiadomosci
news:c3**************************@posting.google.c om...
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!

Jul 17 '05 #4
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
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by Erik Sandblom | last post: by
6 posts views Thread by Prabhat | last post: by
2 posts views Thread by crferguson | last post: by
2 posts views Thread by Evan M. | last post: by
17 posts views Thread by seajay | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.