Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use file_get_contents in PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 187
    Comment on it

    Php offers you to send data in various ways like get, post. Using php you can also use file_get_contents to send data using url. Lets see an example below:-

    $information = array('http' => array(
        'method' => 'POST',
        'content' => 'username=admin_password=235dfd656d2f65df'
    ));
    
    $cript= stream_context_create($information );
    $FileOpen= @fopen($sUrl, 'rb', false, $cript);
    if (!$FileOpen)
    {
        throw new Exception("Problem with $sUrl, $php_errormsg");
    }
    
    $response = @stream_get_contents($FileOpen);
    if ($response === false) 
    {
        throw new Exception("Problem reading data from $sUrl, $php_errormsg");
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: