write html source to a file

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

    write html source to a file

    How can I use a php script running on my web server to read in the
    html source from an arbitrary webpage and then write it to a file on
    my web server?
  • ChronoFish

    #2
    Re: write html source to a file


    "johnathan" <demo@jdcommerc e.com> wrote in message news:18c52625.0 312051424.2d5ef d0a@posting.goo gle.com...[color=blue]
    > How can I use a php script running on my web server to read in the
    > html source from an arbitrary webpage and then write it to a file on
    > my web server?[/color]


    There are a lot of ways to do this. And I'm sure a PHP purist will post over my suggestions, but try this:

    First visit php.net - memorize this as your first stop - it is a great resource






    Then you can write the following:

    <?
    // website to steal from
    $fileArray = file(http://www.example.com/coolpage.html);

    //Open file for writing
    $fileHandle = fopen("/DestinationPath/DestinationFile .html", "w");

    //Dump File
    foreach ($fileArray as $line) fwrite($fileHan dle, $line);

    //Close File
    close($fileHand le);
    ?>


    Comment

    • Shawn Wilson

      #3
      Re: write html source to a file

      johnathan wrote:[color=blue]
      >
      > How can I use a php script running on my web server to read in the
      > html source from an arbitrary webpage and then write it to a file on
      > my web server?[/color]

      Search php.net for fopen() + related functions.

      Shawn
      --
      Shawn Wilson
      shawn@glassgian t.com

      Comment

      • johnathan

        #4
        Re: write html source to a file

        Shawn Wilson <shawn@glassgia nt.com> wrote in message news:<3FD49249. DE18BE4@glassgi ant.com>...[color=blue]
        > johnathan wrote:[color=green]
        > >
        > > How can I use a php script running on my web server to read in the
        > > html source from an arbitrary webpage and then write it to a file on
        > > my web server?[/color]
        >
        > Search php.net for fopen() + related functions.
        >
        > Shawn[/color]

        Thank you for the suggestions. I have been reading about a set of php
        functions called curl_init(), curl_exec(), and so on..... i am sure
        you guys know about it.
        i have successfully used those commands to read raw html source from
        websites, but i am now trying to figure out how to use some of the
        CURLOPT_* options to view a page that requires userid and password and
        is on a secure server. does anybody know how to do this? for example,
        how would i use these curl functions in order to view my online bank
        account summary?

        Comment

        • ChronoFish

          #5
          Re: write html source to a file


          "johnathan" <demo@jdcommerc e.com> wrote in message news:18c52625.0 312091547.558dc 863@posting.goo gle.com...[color=blue]
          > Shawn Wilson <shawn@glassgia nt.com> wrote in message news:<3FD49249. DE18BE4@glassgi ant.com>...[color=green]
          > > johnathan wrote:[color=darkred]
          > > >
          > > > How can I use a php script running on my web server to read in the
          > > > html source from an arbitrary webpage and then write it to a file on
          > > > my web server?[/color]
          > >
          > > Search php.net for fopen() + related functions.
          > >
          > > Shawn[/color]
          >
          > Thank you for the suggestions. I have been reading about a set of php
          > functions called curl_init(), curl_exec(), and so on..... i am sure
          > you guys know about it.
          > i have successfully used those commands to read raw html source from
          > websites, but i am now trying to figure out how to use some of the
          > CURLOPT_* options to view a page that requires userid and password and
          > is on a secure server. does anybody know how to do this? for example,
          > how would i use these curl functions in order to view my online bank
          > account summary?[/color]

          Sounds dangerous and/or illegal. Here's the rope: http://www.php.net/manual/en/ref.curl.php

          -CF


          Comment

          • johnathan

            #6
            Re: write html source to a file

            "ChronoFish " <deja@chronofis h.com> wrote in message news:<snEBb.523 08$dO2.15782@la keread03>...[color=blue]
            > "johnathan" <demo@jdcommerc e.com> wrote in message news:18c52625.0 312091547.558dc 863@posting.goo gle.com...[color=green]
            > > Shawn Wilson <shawn@glassgia nt.com> wrote in message news:<3FD49249. DE18BE4@glassgi ant.com>...[color=darkred]
            > > > johnathan wrote:
            > > > >
            > > > > How can I use a php script running on my web server to read in the
            > > > > html source from an arbitrary webpage and then write it to a file on
            > > > > my web server?
            > > >
            > > > Search php.net for fopen() + related functions.
            > > >
            > > > Shawn[/color]
            > >
            > > Thank you for the suggestions. I have been reading about a set of php
            > > functions called curl_init(), curl_exec(), and so on..... i am sure
            > > you guys know about it.
            > > i have successfully used those commands to read raw html source from
            > > websites, but i am now trying to figure out how to use some of the
            > > CURLOPT_* options to view a page that requires userid and password and
            > > is on a secure server. does anybody know how to do this? for example,
            > > how would i use these curl functions in order to view my online bank
            > > account summary?[/color]
            >
            > Sounds dangerous and/or illegal. Here's the rope: http://www.php.net/manual/en/ref.curl.php
            >
            > -CF[/color]


            whoa.... well, nevermind if it's illegal. i thought it would be okay
            if i am using it to view my own personal information.... thanks
            anyway.

            Comment

            • ChronoFish

              #7
              Re: write html source to a file


              "johnathan" <demo@jdcommerc e.com> wrote in message news:18c52625.0 312101204.43cd6 51@posting.goog le.com...[color=blue][color=green]
              > >
              > > Sounds dangerous and/or illegal. Here's the rope: http://www.php.net/manual/en/ref.curl.php
              > >
              > > -CF[/color]
              >
              >
              > whoa.... well, nevermind if it's illegal. i thought it would be okay
              > if i am using it to view my own personal information.... thanks
              > anyway.[/color]

              If you're viewing your own personal information then the legality of it depends on the license agreement you agreed to with your
              provider (bank or whatever).

              The danger doesn't go away however. You are taking your personal information from an encrypted source to a text source. If the
              machine that is doing the "getting" is the same machine that you're viewing from (i.e. localhost) then there probably isn't anything
              to worry about.

              However if the machine that is doing the "getting" is hosted, then the link from it to your browser can be packet sniffed and it's
              also possible that some of the information could end up in the server's logs. Additionally (as proven by RIAA/Verizon) your ISP may
              have logged some of the data as well.

              -CF


              Comment

              Working...