Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

stream get contents function syntax tag tutorial 2013 Donate at flattr Flattr this





Alert! Connect with 10,000 Chating Online. Join Now

Php stream get contents () function

Write your php code

 
<?php ?>

Php Result


Your code below



(PHP 5)

stream_get_contents -- Reads remainder of a stream into a string

Syntax

string stream_get_contents ( resource handle [, int maxlength [, int offset]] )

Identical to file_get_contents(), except that stream_get_contents() operates on an already open stream resource and returns the remaining contents in a string, up to maxlength bytes and starting at the specified offset.

Parameters

handle (resource)

A stream resource (e.g. returned from fopen())

maxlength (integer)

The maximum bytes to read. Defaults to -1 (read all the remaining buffer).

offset (integer)

Seek to the specified offset before reading. Added in PHP 5.1.0.

Return Values

Returns a string, or FALSE on failure.

Examples

Example 1. stream_get_contents() example

<?php

if ($stream = fopen('http://www.example.com', 'r')) {
    
// print all the page starting at the offset 10
    
echo stream_get_contents($stream, -1, 10);

    
fclose($stream);
}


if (
$stream = fopen('http://www.example.net', 'r')) {
    
// print the first 5 bytes
    
echo stream_get_contents($stream, 5);

    
fclose($stream);
}

?>

See Also

fgets()
fread()
fpassthru()

Note: This function is binary-safe.

Php stream get contents Function syntax tag

stream get contents php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php stream get contents syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online