This is a creation in
Article, where the information may have evolved or changed.
The program is simple, with a simple HTTP request to protect the server daemon
Package Mainimport ("FMT" "Net" "Net/http" "Strings" "Time") var (info []net. Addrip
Login Baidu, the first of course is to catch Baidu's login package, because it is a Web login, the most convenient nature is httpwatch, I use the test account is itiandatest1, the password is Itianda, grab package results:
Copy Code code as
To log on to Baidu, you must first capture the Baidu logon package. Because it is a webpage logon, httpwatch is the most convenient. The test account I use is itiandatest1 and the password is itianda. The packet capture result is as follows:
Copy
Copy codeThe Code is as follows: // determine the Remote File
Function check_remote_file_exists ($ url)
{
$ Curl = curl_init ($ url );
// Do not retrieve data
Curl_setopt ($ curl, CURLOPT_NOBODY, true );
// Send the request
$ Result = curl_exec ($
The code is as follows:
Judging remote Files
function Check_remote_file_exists ($url)
{
$curl = Curl_init ($url);
Do not retrieve data
curl_setopt ($curl, Curlopt_nobody, true);
Send Request
$result = curl_exec ($curl);
$found = false;
If the
Php uses curl to determine whether a remote file exists. Copy the code as follows: determine the remote file functioncheck_remote_file_exists ($ url) {$ curlcurl_init ($ url); do not retrieve data curl_setopt ($ curl, CURLOPT_NOBODY, true); send
Copy CodeThe code is as follows:
Judging remote Files
function Check_remote_file_exists ($url)
{
$curl = Curl_init ($url);
Do not retrieve data
curl_setopt ($curl, Curlopt_nobody, true);
Send Request
$result = curl_exec ($curl);
$found = false;
If
Php uses curl to determine whether a remote file exists. some of our programs need to determine whether the file exists before performing subsequent operations.
The code is as follows:
// Determine the remote file
Function check_remote_file_exists (
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.