How to display a website content on another

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Murphy

    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!
  • CountScubula

    #2
    Re: How to display a website content on another

    "Brian Murphy" <yasbergy@yahoo .com> wrote in message
    news:c36d2949.0 401121438.50188 ce2@posting.goo gle.com...[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


    Comment

    • Pedro Graca

      #3
      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?fo rmat=html&categ ories=all
      or download.php?fo rmat=csv&catego ries=php%2casp
      or download.php?fo rmat=php&catego ries=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?fo rmat=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.c om/","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(fil e_get_contents( 'http://www.yourdomain. com/download.php?fo rmat=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 =--

      Comment

      • Chung Leong

        #4
        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_so mewhere_dot_com ); </script>

        content.js.php:

        <?php

        // get the page
        $html = file_get_conten ts("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($co ntent, "\\\r\n\t'" );
        echo "var content_from_so mewhere_dot_com = '$js_str';";
        }

        ?>

        Uzytkownik "Brian Murphy" <yasbergy@yahoo .com> napisal w wiadomosci
        news:c36d2949.0 401121438.50188 ce2@posting.goo gle.com...[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]


        Comment

        • Berislav Lopac

          #5
          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


          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


          Comment

          Working...