SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: include()

  1. #1
    SitePoint Member
    Join Date
    Sep 2008
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    include()

    i want to know how to include template from other website, instead of same ip?
    i use include but it seems it cant access the function in that file.
    it displays "undefined function" error

  2. #2
    SitePoint Evangelist
    Join Date
    May 2006
    Location
    Denmark
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can do include 'http://www.google.com';, but you need both allow_url_fopen and allow_url_include turned on. By default, the former is, but the latter isn't. Therefore, you may want to use e.g. echo file_get_contents('http://www.google.com'); instead.

  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Manual says:
    If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see List of Supported Protocols/Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
    And also there is a warning which you must have seen/read before:
    Warning

    Windows versions of PHP prior to PHP 4.3.0 do not support access of remote files via this function, even if allow_url_fopen is enabled.
    So now you must be clear about it how you can do and what you can do with include/require functions PHP.

    Also can you please post your code what you have done so far to include it?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


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
  •