Last active
December 29, 2015 15:44
-
-
Save byronhe/1c127960168b1f8bd172 to your computer and use it in GitHub Desktop.
https client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url="https://weixin.qq.com"; | |
$url="https://www.alipay.com"; | |
$url="https://www.baidu.com"; | |
// Initialize session and set URL. | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
// Set so curl_exec returns the result instead of outputting it. | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); | |
curl_setopt($ch, CURLOPT_SSL_FALSESTART, 1); | |
curl_setopt($ch, CURLOPT_SSL_ENABLE_ALPN, 1); | |
// CURLOPT_CAINFO is auto detected,see http://docs.guzzlephp.org/en/latest/request-options.html#verify | |
// https://github.com/dropbox/dropbox-sdk-php/blob/master/lib/Dropbox/Curl.php | |
for($i=0;$i<10;++$i){ | |
// Get the response and close the channel. | |
$response = curl_exec($ch); | |
if($response){ | |
echo $response; | |
}else{ | |
echo "GET ",$url," failed.\n"; | |
} | |
} | |
curl_close($ch); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment