GET请求示例代码

示例代码仅供参考,请以自身具体业务需要为准

PHP

/**
 * 通过URL获取页面信息
 * @param $url 地址
 * @return mixed 返回页面信息
 */
function get_url($url)
{
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$url); //设置访问的url地址
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);//不输出内容
  $result = curl_exec($ch);
  curl_close ($ch);
  return $result;
}
Copyright © Vanswo 2020 all right reserved,powered by Gitbook该文章修订时间: 2020-08-17 14:18:02

results matching ""

    No results matching ""