This function is the preferred way to read the contents of a file into
a string.
The function itself does nothing but puts the source of the web page you supply it into a string available for use throughout your script. <?php echo file_get_contents("dtd.txt"); ?> You can use either the curl or the http library. You send a http request, and can use the library to get the information from the http response. $dat = @file_get_contents( "http://www.bbc.co.uk/" ); if( $dat ) echo htmlentities( $dat ); |
php file_get_contents
PMA00:44
Categories: PHP
Related Posts:
How to Read an RSS Feed With PHP <?php include("../includes/config.php"); include("../includes/dbcon.php"); $tt_res=mysql_query("SELECT * FROM `rss_data`"); $num = mysql_num_rows($tt_res); if($num!=0) { $tt="TRUNCATE TABLE `rss_data`"; mysql_query($t… Read More
Top codeigniter interview question and answers codeigniter interview question What is codeigniter? Codeigniter is open source , web application framework.Its is for building websites using php.Codeigniter is loosely based on MVC pattern.Most simple framework in ph… Read More
PHP Sessions - setcookie mplement a session timeout of your own. Both options mentioned by others session.gc_maxlifetime and session.cookie_lifetime are not reliable. session.gc_maxlifetime session.gc_maxlifetime specifies the number o… Read More
PHP INTERFACES Class inheritanceenables you to describe a parent-child relationshipbetween classes. For example, you might have a base class Shapefrom which both Squareand Circlederive. However, you might often want to add a… Read More
Php Session Security-Internet Security Because a session may contain sensitive information, you need to treat the session as a possible security hole. Session security is necessary to create and implement a session. If someone is listening in or sno… Read More
PHP isn’t as easy as working with JSON <?php $list = array( "eggs", "bread", "milk", "bananas", "bacon", "cheese" ); $xml = new SimpleXMLElement("<list />"); foreach($list as $item) { $xml->addChild("item", $item); } // for nice output $dom = dom_impo… Read More
Aarray And multiple array values Aarray And multiple array values array[key_element1] => array(1, 2,3); array[key_element2] => array(4, 5, 6); associative arrays array[key1] => array(key => value1, key => value2, key => value3); … Read More
download a file by php code-PHP download files code Basic example for download a file by php <?php $file="http://testexample.com/your_test_file.jpg"; // path to your file header('Content-Type: application/octet-stream'); header('Content-Disposition: attachm… Read More
PHP-final METHODS-override a final method However, there are times where you might want to make sure that a method cannot be re-implemented in its derived classes. For this purpose, PHP supports the Java-like final access modifier for methods that declares … Read More
PHP Session expire-minutes inactivity PHP Session expire-minutes inactivity session_cache_limiter('public'); session_cache_expire(15); //should expire after 15 minutes inactivity asy way to handle this, is to set a variable to $_SESSION every time … Read More
Mysql Join query Codeigniter Mysql Join query Codeigniter code loads and initializes the database class based on your configuration settings. $query = $this->db->query('SELECT name, title, email FROM my_table'); foreach ($query->result() … Read More
Top PHP Tutorial website PHP - Wikipedia, the free encyclopedia PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. As of January 2013, PHP was installed on ... http… Read More
php-best top 20 Open Source Content Management Systems best top 20 php Open Source Content Management Systems php-best top 20 Open Source Content Management Systems All this open source content management system written in PHP/mySQL and well configured themes and modules for … Read More
Rewriting Keyword-Rich URLs rules for your .htaccess file Modify the .htaccessfile in your seophpfolder like this: RewriteEngine On # Rewrite numeric URLs RewriteRule ^Products/C([0-9]*)/P([0-9]*)\.html$ i /product.php?category_id=$1&product_id=$2… Read More
PHP Interview Questions with Answers-part1 What is PHP? PHP is a server side scripting language used for web development applications. Php is the powerful tool for making dynamic website. Ma… Read More