Last active
August 17, 2020 03:52
-
-
Save retanoj/60411c79012f22140b5ae4cb7f1e497c to your computer and use it in GitHub Desktop.
fin1te/safecurl demo
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 | |
| include('vendor/autoload.php'); | |
| use fin1te\SafeCurl\SafeCurl; | |
| use fin1te\SafeCurl\Options; | |
| use fin1te\SafeCurl\Exception; | |
| try { | |
| $url = 'https://mp.weixin.qq.com/s/uYF7bE9Ob-0hfFVNO7Pcpw'; | |
| $options = new Options(); | |
| $options->enableFollowLocation(); | |
| $options->enablePinDns(); | |
| $curlHandle = curl_init(); | |
| $response = SafeCurl::execute($url, $curlHandle, $options); | |
| var_dump($response); | |
| } catch (Exception $e) { | |
| // url 验证不通过 | |
| var_dump($e); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment