looking for help with php include please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spacedog
    Yes that IS me. Bitch.
    • Nov 2001
    • 14149

    #1

    looking for help with php include please

    What do I need to do to get the following code to work on pages that do not have the .php extension.. seems it only works when the page is pagename.php, but I need it to work on .shtml, .htm & .html, etc... what can I do?

    PHP Code:
    <?=file_get_contents("http://www.domain.com/file.htm")?>
  • spacedog
    Yes that IS me. Bitch.
    • Nov 2001
    • 14149

    #2
    bump.. please help

    Comment

    • Adultnet
      Confirmed User
      • Sep 2003
      • 8713

      #3
      <!--#include file="filename.what ever" -->


      TrafficCashGold Paying Webmasters Since 1996!

      Awesome Conversions! Fast Weekly Payments! Over 125 Tours!

      Comment

      • spacedog
        Yes that IS me. Bitch.
        • Nov 2001
        • 14149

        #4
        Originally posted by Adultnet
        <!--#include file="filename.what ever" -->
        that don't work either

        Comment

        • AnnaSucks
          Confirmed User
          • Jun 2006
          • 279

          #5
          Originally posted by spacedog
          What do I need to do to get the following code to work on pages that do not have the .php extension.. seems it only works when the page is pagename.php, but I need it to work on .shtml, .htm & .html, etc... what can I do?
          Do you mean you want to have that code on a page other than .php or you want to include files other than .php? I don't think you can put php ON a .html page, but you sure can INCLUDE a html page on a .php page. If that makes any sense.

          This one has always worked for me:

          PHP Code:
          <?php include "file.php"; ?>
          A man without a belly is not a man

          Comment

          • fris
            Too lazy to set a custom title
            • Aug 2002
            • 55679

            #6
            Originally posted by spacedog
            that don't work either
            .htaccess

            AddType text/html .shtml .html .inc
            AddHandler server-parsed .shtml .html .inc

            or if you want html files to be treated as php add this

            RemoveHandler .html .htm
            AddType application/x-httpd-php .html .htm
            Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

            Comment

            • spacedog
              Yes that IS me. Bitch.
              • Nov 2001
              • 14149

              #7
              ok..the htaccess thing, I'm lost.. might as well be chinese, don't make sense to me..

              the file is .htm, but I can name it .php, whatever, is just a page.. but need to be able to include it externally on other pages, like jaymancash's potd blog plugin, how you use the php include code to get the table to appear on our pages, I'd like to provide the php include code to give to others to have my table show up on their page. I don't want an Iframe or javascript, it has to be php include

              Comment

              • GrouchyAdmin
                Now choke yourself!
                • Apr 2006
                • 12085

                #8
                You have to do what Fris said.

                What that will do (create a file named .htaccess in your index root), and put the content in it, will have it parse all of the listed files as though they were native PHP. Other hacks are more ineligant - however, this will slow you down a bit for static content, not that you'll really notice.

                You also don't want to do a PHP include across sites, that allows for cross-scripting. If you want them to force inline, that's one of the few choices, but it's incredibly retarded. See above reasoning.

                Comment

                • bl4h
                  Confirmed User
                  • Jul 2006
                  • 1282

                  #9
                  put this in your htaccess file

                  if you wanted to parse html as php do this (though you shouldnt do this)

                  in .htaccess file

                  AddType application/x-httpd-php .html .htm
                  heres how you include. Name the file with whatever you want to include something like ass.inc

                  PHP Code:
                  <?PHP include 'ass.inc'; ?>
                  Including the file remotely? STUPID THING TO DO.

                  Comment

                  • spacedog
                    Yes that IS me. Bitch.
                    • Nov 2001
                    • 14149

                    #10
                    Originally posted by toonpornblog
                    You have to do what Fris said.

                    What that will do (create a file named .htaccess in your index root), and put the content in it, will have it parse all of the listed files as though they were native PHP. Other hacks are more ineligant - however, this will slow you down a bit for static content, not that you'll really notice.

                    You also don't want to do a PHP include across sites, that allows for cross-scripting. If you want them to force inline, that's one of the few choices, but it's incredibly retarded. See above reasoning.
                    but the php include needs to work externally.. sites that are not my own. I believe the .htaccess only allows this to work on sites on my own server..right?

                    Comment

                    • bl4h
                      Confirmed User
                      • Jul 2006
                      • 1282

                      #11
                      Produce an XML file and build a script to parse and display it on external hosts.

                      You dont use include for external stuff..

                      Comment

                      • spacedog
                        Yes that IS me. Bitch.
                        • Nov 2001
                        • 14149

                        #12
                        Originally posted by bl4h
                        Produce an XML file and build a script to parse and display it on external hosts.

                        You dont use include for external stuff..
                        have you seen jaymancash's potd/motd plugin?

                        It is a php include., with a full url
                        this is what I am trying to do, but it's not working on any pages that do not have .php as the extension

                        Comment

                        • GrouchyAdmin
                          Now choke yourself!
                          • Apr 2006
                          • 12085

                          #13
                          Originally posted by spacedog
                          but the php include needs to work externally.. sites that are not my own. I believe the .htaccess only allows this to work on sites on my own server..right?
                          Well, yeah. If they're trying to put PHP in a non .php file or don't have the types set, it's their own problem with implementation.

                          If you have to have something work externally with URL wrappers, at least look into readfile.. that won't execute code unless you explicitly eval() it.

                          Comment

                          • bl4h
                            Confirmed User
                            • Jul 2006
                            • 1282

                            #14
                            Originally posted by spacedog
                            have you seen jaymancash's potd/motd plugin?

                            It is a php include., with a full url
                            this is what I am trying to do, but it's not working on any pages that do not have .php as the extension
                            well thats just plain stupid. Let me sign up and check this out

                            Comment

                            • spacedog
                              Yes that IS me. Bitch.
                              • Nov 2001
                              • 14149

                              #15
                              Originally posted by bl4h
                              well thats just plain stupid. Let me sign up and check this out
                              it works for them, & I want to do the same thing.. their code works on my .htm pages & .php, etc.. but when I create my own page & try to include it, it only works on .php.. maybe I should ask jay

                              Comment

                              • nolaman
                                Confirmed User
                                • Mar 2004
                                • 1001

                                #16
                                try using fread()
                                PHP Programmer ICQ 215-504-788

                                Comment

                                • bl4h
                                  Confirmed User
                                  • Jul 2006
                                  • 1282

                                  #17
                                  Well i dont think theyre using include then if it works in html files. whatever. Its your shit

                                  Comment

                                  • spacedog
                                    Yes that IS me. Bitch.
                                    • Nov 2001
                                    • 14149

                                    #18
                                    Originally posted by bl4h
                                    Well i dont think theyre using include then if it works in html files. whatever. Its your shit
                                    yep, it sure looks like a php include..

                                    PHP Code:
                                     <?=file_get_contents("http://www.jaymancash.com/POTD/Raven-Riley/MTOjEx/150/150/")?>

                                    Comment

                                    • borked
                                      Totally Borked
                                      • Feb 2005
                                      • 6284

                                      #19
                                      check to make sure URL fopen is enabled on your PHP server, then do what Fris said to have all the local files served as php files.

                                      For coding work - hit me up on andy // borkedcoder // com
                                      (consider figuring out the email as test #1)



                                      All models are wrong, but some are useful. George E.P. Box. p202

                                      Comment

                                      • borked
                                        Totally Borked
                                        • Feb 2005
                                        • 6284

                                        #20
                                        that said, you clients also have to have it enabled.
                                        Have a look at Apache SSI
                                        If you're going to allow remote includes, make sure you configure Apache to disable HTTP PUT methods etc. Otherwise, you could be opening up a big secruity hole for well-crafted remote code to overwrite your files etc. Sure you can allow remote includes, but if you haven't secured the installation, you could be enabling remote writing at the same time.

                                        For coding work - hit me up on andy // borkedcoder // com
                                        (consider figuring out the email as test #1)



                                        All models are wrong, but some are useful. George E.P. Box. p202

                                        Comment

                                        • GrouchyAdmin
                                          Now choke yourself!
                                          • Apr 2006
                                          • 12085

                                          #21
                                          Originally posted by borked
                                          that said, you clients also have to have it enabled.
                                          Have a look at Apache SSI
                                          He's trying to do a remote url open. I've never seen SSI support that, because, well, it's retarded, and wrong. You can't do a <!--#include "http://foo" -->

                                          Comment

                                          • fris
                                            Too lazy to set a custom title
                                            • Aug 2002
                                            • 55679

                                            #22
                                            you can do a php include with a full url
                                            Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                                            Comment

                                            • bl4h
                                              Confirmed User
                                              • Jul 2006
                                              • 1282

                                              #23
                                              why not do it the right way. Does this POTD change once a day? Why would you include something (have your server connect to a remote host for every single page load) that changes only once a day. fucking christ

                                              put 30 ravin riley pictures in a directory and cycle them at random. same dumb effect

                                              Comment

                                              • spacedog
                                                Yes that IS me. Bitch.
                                                • Nov 2001
                                                • 14149

                                                #24
                                                Originally posted by bl4h
                                                why not do it the right way. Does this POTD change once a day? Why would you include something (have your server connect to a remote host for every single page load) that changes only once a day. fucking christ

                                                put 30 ravin riley pictures in a directory and cycle them at random. same dumb effect
                                                You're missing the point here.. I'm not talking about rotating images or tables on my own sites, I am talking about rotating tables/images of MINE to be able to be php included on OTHER PEOPLES pages.. were I disussing my own pages, I would just code right into the page itself, or include with php extension, but since I am trying to have this include work on others pages, the page/table/image being included coming from my domain & hosting, & the php include string being called from a different domain/host.

                                                Certainly there are other various methods of getting a simple potd/motd, etc to work, however, standard potd/motd, etc are only images & links, whereas what I want to accomplish is similar to the method of Jaymancash & some others where the potd/motd etc is enclosed within a table so that there is also text, etc, so that with other webmasters placing the php include on their pages would have my table/image etc being displayed on their sites, but the page/table etc is hosted by me.. get it now?

                                                If I need be fucking with apache, & all this other server admin shit, looks like I need to have someone do it for me as I haven't a friggen idea about any of that, lol.... I did however spend several hours reading about fread, fopen, etc.. so, eventually can figure all this out, I hope

                                                Comment

                                                • borked
                                                  Totally Borked
                                                  • Feb 2005
                                                  • 6284

                                                  #25
                                                  Originally posted by spacedog
                                                  You're missing the point here.. I'm not talking about rotating images or tables on my own sites, I am talking about rotating tables/images of MINE to be able to be php included on OTHER PEOPLES pages.. were I disussing my own pages, I would just code right into the page itself, or include with php extension, but since I am trying to have this include work on others pages, the page/table/image being included coming from my domain & hosting, & the php include string being called from a different domain/host.

                                                  Certainly there are other various methods of getting a simple potd/motd, etc to work, however, standard potd/motd, etc are only images & links, whereas what I want to accomplish is similar to the method of Jaymancash & some others where the potd/motd etc is enclosed within a table so that there is also text, etc, so that with other webmasters placing the php include on their pages would have my table/image etc being displayed on their sites, but the page/table etc is hosted by me.. get it now?

                                                  If I need be fucking with apache, & all this other server admin shit, looks like I need to have someone do it for me as I haven't a friggen idea about any of that, lol.... I did however spend several hours reading about fread, fopen, etc.. so, eventually can figure all this out, I hope
                                                  I had it working fine with php and with perl (for those that didn't have php remote include configured in their php) long before AFF did their geoIP ads - I had over 300 people using my ad includes and made me a mint.

                                                  With php, it's a simple include("http://foo.com")
                                                  with perl/cgi: it's make a client cgi file called "proxy.cgi" with the contents:

                                                  Code:
                                                  use LWP::Simple;
                                                  print "Content-type:text/html\n\n";
                                                  getprint ($ENV{'QUERY_STRING'});
                                                  then have the clients add this code wherever they want to include your html:

                                                  <!--#include virtual="/cgi-bin/proxy.pl?http://yourserver.com/yourpage.html" -->

                                                  For coding work - hit me up on andy // borkedcoder // com
                                                  (consider figuring out the email as test #1)



                                                  All models are wrong, but some are useful. George E.P. Box. p202

                                                  Comment

                                                  Working...