Include the data from a text file

Discussion in 'PHP' started by archard, Sep 29, 2007.

  1. #1
    I tried using the include() function but it didn't work. All I want it to be able to specify the URL of a text file and have the contents of said file be included into the file. I know this can be done with shtml but I need this in PHP.
     
    archard, Sep 29, 2007 IP
  2. North Carolina SEO

    North Carolina SEO Well-Known Member

    Messages:
    1,327
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    105
    #2
    North Carolina SEO, Sep 29, 2007 IP
    archard likes this.
  3. MakeADifference

    MakeADifference Peon

    Messages:
    476
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It is working for me...

    <?
    include ("temp.txt");
    as well as
    include("http://someurl/temp.txt");
    ?>
     
    MakeADifference, Sep 29, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    allow_url_fopen needs to be enabled in php.ini in order to include files via HTTP.
     
    nico_swd, Sep 29, 2007 IP
  5. archard

    archard Peon

    Messages:
    221
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    include() didn't work even though allow_url_fopen was enabled. readfile() did work however.
     
    archard, Sep 29, 2007 IP