Answers for "get_contents php"

PHP
0

transfer file using file_get_content

$filename = "/path/to/uploaded/file.zip";
$file_contents = file_get_contents($filename);    

$content =  "--".MULTIPART_BOUNDARY."rn".
            "Content-Disposition: form-data; name="".FORM_FIELD.""; filename="".basename($filename).""rn".
            "Content-Type: application/ziprnrn".
            $file_contents."rn";

// add some POST fields to the request too: $_POST['foo'] = 'bar'
$content .= "--".MULTIPART_BOUNDARY."rn".
            "Content-Disposition: form-data; name="foo"rnrn".
            "barrn";

// signal end of request (note the trailing "--")
$content .= "--".MULTIPART_BOUNDARY."--rn";
Posted by: Guest on March-24-2020
1

file_get_contents php

function url_get_contents ($Url) {
    if (!function_exists('curl_init')){ 
        die('CURL is not installed!');
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $Url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);
    curl_close($ch);
    return json_decode($output,JSON_OBJECT_AS_ARRAY);
}
Posted by: Guest on August-09-2021

Browse Popular Code Answers by Language