Home > Backend Development > PHP Tutorial > PHP获取远路文件信息

PHP获取远路文件信息

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:38:58
Original
742 people have browsed it

PHP获取远程文件信息

    $url = 'http://.../config';    $username = 'username';    $password = 'password';        $curl = curl_init();    curl_setopt($curl, CURLOPT_URL, $url);    curl_setopt($curl, CURLOPT_FAILONERROR, 1);    curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);    curl_setopt($curl, CURLOPT_USERPWD, $username . ":" . $password);    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: text/plain'));    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);    $result = curl_exec($curl);    curl_close($curl);        // 获取的内容    echo $result;
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
curl simulated login
From 1970-01-01 08:00:00
0
0
0
Convert cURL command line to PHP cURL code
From 1970-01-01 08:00:00
0
0
0
Convert command line cURL to PHP cURL
From 1970-01-01 08:00:00
0
0
0
How to set boolean value true in php curl
From 1970-01-01 08:00:00
0
0
0
Please tell me, php curl request page shows blank
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template