Connecting Tech Pros Worldwide Help | Site Map

How to display a website content on another

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 02:24 AM
Brian Murphy
Guest
 
Posts: n/a
Default 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!

  #2  
Old July 17th, 2005, 02:24 AM
CountScubula
Guest
 
Posts: n/a
Default Re: How to display a website content on another

"Brian Murphy" <yasbergy@yahoo.com> wrote in message
news:c36d2949.0401121438.50188ce2@posting.google.c om...[color=blue]
> 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![/color]


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


  #3  
Old July 17th, 2005, 02:24 AM
Pedro Graca
Guest
 
Posts: n/a
Default Re: How to display a website content on another

Brian Murphy wrote:[color=blue]
> 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![/color]

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 =--
  #4  
Old July 17th, 2005, 02:24 AM
Chung Leong
Guest
 
Posts: n/a
Default Re: How to display a website content on another

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" <yasbergy@yahoo.com> napisal w wiadomosci
news:c36d2949.0401121438.50188ce2@posting.google.c om...[color=blue]
> 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![/color]


  #5  
Old July 17th, 2005, 02:26 AM
Berislav Lopac
Guest
 
Posts: n/a
Default Re: How to display a website content on another

Brian Murphy wrote:[color=blue]
> 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![/color]

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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.