Online Shopping : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to
Did You Find This Entry Useful?

25 of 38 people (66%) answered Yes
Recently 8 of 10 people (80%) answered Yes


how do i include a remote file using php

Nov 27th, 2008 02:29
healthy man, dman, Praveen Kumar Kukkapalli, Philip Olson, sanket gupta,

Simple way is to use file() function
$file_content = file("");
It will return an array.
More information can be found at
Check out the following :
    PHP Manual : Chapter 20. Using remote files
Examples exist for both FTP and HTTP Methods.  Also, note the include 
function :
    PHP Manual : Include()
Include can also include remote files although has a few conditions 
such as :
    1. URL fopen wrappers must be enabled (they are by default)
    2. Can't include() remote files when using the windows OS
The above manual entries contain more detailed information on these 
topics and includes links/information about related functions.  Here 
are a few examples :
    include '';
If you need it as a variable, try :
    $remote_site = implode(file(''),'');
If you've already opened it with fopen() :
    $fp = fopen('','r');