Y T Nuke  
Results 1 to 14 of 14
Hi, I have footer.php file in my wpA site and file.php in my wpB website. ...
  1. #1
    Claudiu's Avatar
    Claudiu is offline Regular Member
    Join Date
    Feb 2009
    Location
    127.0.0.1
    Posts
    279
    Reputation
    3
    Thanks
    1,010
    Thanked 78 Times in 31 Posts

    Default How to Include External PHP File into footer.php

    Hi,

    I have footer.php file in my wpA site and file.php in my wpB website.

    I want to include file.php into footer.php

    i've tried include = 'http://websiteB/file.php' and gets me this error
    Warning: include() [function.include]: URL file-access is disabled in the server configuration in /path_to/websiteA/footer.php
    I've looked over google and couln't find any trick to solve this ..

    I'm thinking rewriting the function.php might work .. but i don't know what to write there ...

    I'd appreciate some help on this ..
    Last edited by Claudiu; 03-31-2010 at 08:26 AM.

  2. #2
    BlackOut's Avatar
    BlackOut is offline Newbies
    Join Date
    Jan 2008
    Posts
    39
    Reputation
    10
    Thanks
    17
    Thanked 28 Times in 13 Posts

    Default Re: How to Include External PHP File into footer.php

    You should use the full path instead of the url in include. So add include("/pathto/websiteb/file.php"); incase websiteb is hosted somewhere else you should copy file.php file to websiteA's folder.

  3. #3
    corbin2 is offline Registered Member
    Join Date
    Jan 2010
    Posts
    66
    Reputation
    11
    Thanks
    15
    Thanked 42 Times in 24 Posts

    Default Re: How to Include External PHP File into footer.php

    Some Hosts do not allow this kind of includes.

  4. #4
    namewithnogaps's Avatar
    namewithnogaps is offline Junior Member
    Join Date
    Mar 2010
    Posts
    160
    Reputation
    18
    Thanks
    103
    Thanked 69 Times in 15 Posts

    Default Re: How to Include External PHP File into footer.php

    usually hosts won't allow including externally hosted files.

  5. #5
    tpaolo is offline Regular Member
    Join Date
    May 2009
    Posts
    248
    Reputation
    6
    Thanks
    44
    Thanked 23 Times in 17 Posts

    Default Re: How to Include External PHP File into footer.php

    you should allow base_url module, btw including php files from external sources is a risky practice most servers wouldn't allow when running sharing enviroments

    you better use javascript or, depending on the content of file.php, some scraping tool

  6. #6
    shaundunne's Avatar
    shaundunne is offline Registered Member
    Join Date
    Apr 2009
    Location
    London
    Age
    29
    Posts
    56
    Reputation
    12
    Thanks
    17
    Thanked 18 Times in 10 Posts

    Default Re: How to Include External PHP File into footer.php

    you could try using an iframe.

    include, require and require_once will work if you are including from the same server.

  7. #7
    Claudiu's Avatar
    Claudiu is offline Regular Member
    Join Date
    Feb 2009
    Location
    127.0.0.1
    Posts
    279
    Reputation
    3
    Thanks
    1,010
    Thanked 78 Times in 31 Posts

    Default Re: How to Include External PHP File into footer.php

    i appreciate your input guys, but it was kinda obvious that i can't use the include as i've posted the include error i got .. anyway .. problem solved with another turnaround trick ..

    for those having similar problem google for - fopen read external file -

  8. #8
    demoniox's Avatar
    demoniox is offline Registered Member
    Join Date
    Mar 2007
    Posts
    96
    Reputation
    13
    Thanks
    15
    Thanked 82 Times in 29 Posts

    Default Re: How to Include External PHP File into footer.php

    use this eval(file_get_contents($file));

  9. #9
    Join Date
    Oct 2007
    Posts
    914
    Reputation
    115
    Thanks
    36
    Thanked 424 Times in 274 Posts

    Default Re: How to Include External PHP File into footer.php

    Just create a link in your footer to a blank php page, with a header ( ); redirect function to the offer site page leading to your desired target file/source.

    All you do is:

    1. Create a new php page and add it to your site, with the following link in the source code:

    <?php
    header("Location: http://www.your-target-link.here");
    ?>

    2. Create the link in your site footer to this new php page you've just created, within your current site that the visitor with land on.

    They will click the link in the footer and it will take them instantly to the offsite page where whatever file, zip, page, etc. you want to have popup.


    You don't have to worry about the hosts not approving the redirect, as it is standard php practice. However, you do have to be aware of whatever content the visitor is getting on the other end of that link, as it will get you shut down, should it be something unethical. To each their own, just not my bag.
    Last edited by aftershock2020; 03-31-2010 at 05:08 PM.

  10. #10
    smashedpumpkins's Avatar
    smashedpumpkins is offline Regular Member
    Join Date
    Mar 2010
    Posts
    231
    Reputation
    13
    Thanks
    8
    Thanked 80 Times in 13 Posts

    Default Re: How to Include External PHP File into footer.php

    Use the following.
    PHP Code:
    <?php include($_SERVER['DOCUMENT_ROOT'].'/file.php'); ?>

  11. #11
    asif2bd is offline Newbies
    Join Date
    Jan 2009
    Location
    DK-BD
    Age
    25
    Posts
    40
    Reputation
    10
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: How to Include External PHP File into footer.php

    Server fopen function is disabled. try including java file and wrote code at java script, then run java from footer.

  12. #12
    russaus's Avatar
    russaus is offline Junior Member
    Join Date
    Mar 2010
    Location
    /dev/null & canada
    Posts
    168
    Reputation
    9
    Thanks
    13
    Thanked 16 Times in 14 Posts

    Default Re: How to Include External PHP File into footer.php

    Quote Originally Posted by smashedpumpkins View Post
    Use the following.
    PHP Code:
    <?php include($_SERVER['DOCUMENT_ROOT'].'/file.php'); ?>
    this is not for linking externally (see title)

  13. #13
    dremy154 is offline Newbies
    Join Date
    Feb 2010
    Posts
    29
    Reputation
    10
    Thanks
    43
    Thanked 2 Times in 1 Post

    Default Re: How to Include External PHP File into footer.php

    Quote Originally Posted by Claudiu View Post
    i appreciate your input guys, but it was kinda obvious that i can't use the include as i've posted the include error i got .. anyway .. problem solved with another turnaround trick ..

    for those having similar problem google for - fopen read external file -
    for anyone else that needs to know how to do this, it depends on your server's php.ini configuration. Most will have this function disabled; however on hostgator, surprisingly they have the variable set to on, and this is in shared hosting!!!

    search this in your php.ini file:
    Code:
    allow_url_include
    if it is set like this :
    Code:
    allow_url_include = Off
    set it to "On" and save the php.ini

    hope this helps

  14. #14
    dremy154 is offline Newbies
    Join Date
    Feb 2010
    Posts
    29
    Reputation
    10
    Thanks
    43
    Thanked 2 Times in 1 Post

    Default Re: How to Include External PHP File into footer.php

    Oh, and I will tell you this from experience, if your host is Godaddy, you don't have access to the php.ini file, AND fopen is disabled so you would definitely have to find a workaround. Java sound like a viable alternative, I will check it out.

    peace

AdStract


Advertise on Black Hat World

Similar Threads

  1. Replies: 0
    Last Post: 11-13-2008, 03:42 PM
  2. php include with Blogsolution
    By theadultsplayground in forum Blogging
    Replies: 3
    Last Post: 07-04-2008, 06:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
  SEnukeX SEO Software
Proudly Powered by Hostwinds.com Web Hosting Click Here For Exclusive BHW Discounts!

Cheap Web Hosting


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76