Skip to content

Instantly share code, notes, and snippets.

@retanoj
Last active August 17, 2020 03:52
Show Gist options
  • Select an option

  • Save retanoj/60411c79012f22140b5ae4cb7f1e497c to your computer and use it in GitHub Desktop.

Select an option

Save retanoj/60411c79012f22140b5ae4cb7f1e497c to your computer and use it in GitHub Desktop.
fin1te/safecurl demo
<?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