Created
January 15, 2018 03:29
-
-
Save shierw/d1752723ee4519edcf0269662c08c1c0 to your computer and use it in GitHub Desktop.
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
/** | |
*$url = 'http://wx.qlogo.cn/mmopen/xu0fLo9waqKSTDO7j0kSO41O5Luq3LB6ozUvY4O7OsXUWNicB49fBs8nGYzoqcwGDARQZHpVuic4JSDngEVjVo10BoiaPd0iciaOb/0'; | |
*$a = curl_file_get_contents($url); | |
*file_put_contents('uploads/2.jpg', $a); | |
*/ | |
function curl_file_get_contents($durl){ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $durl); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 2); | |
curl_setopt($ch, CURLOPT_USERAGENT, _USERAGENT_); | |
curl_setopt($ch, CURLOPT_REFERER,_REFERER_); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$r = curl_exec($ch); | |
curl_close($ch); | |
return $r; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment