简介 目录 评价 推荐
  • 慕粉0118 2017-02-16
    使用file_get_contents();报错failed to open stream: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? in D:\phpstudy\phpStudy\WWW\queryPhoneNumber\libs\httpRequest.php on line 35 将php.ini中的 extension=php_openssl.dll 开启就可以了,只要是使用函数file_get_contents访问 https 的网站都要开启
    0赞 · 0采集
  • 慕粉0118 2017-02-16
    http_build_query(); 生成 url-encoded 之后的请求字符串描述string http_build_query ( array formdata [, string numeric_prefix] ) 示例: <?php $data = array('foo'=>'bar', 'baz'=>'boom', 'cow'=>'milk', 'php'=>'hypertext processor'); echo http_build_query($data); /* 输出: foo=bar&baz=boom&cow=milk&php=hypertext+processor */ ?>
    0赞 · 0采集
  • car 2016-12-18
    file_get_contents无法请求https连接的解决方法 windows下的PHP,只需要到php.ini中把extension=php_openssl.dll前面的;删掉,重启服务就可以了
    0赞 · 0采集
  • 慕粉3216583 2016-05-14
    http_build_query 生成URL encode之后的字符串 strpost查找字符在字符串中首次出现的位置 如果没有找到返回false
    0赞 · 0采集
  • 林静听蝉 2016-03-03
    3-2 API请求数据 QueryPhone.php namespace app; use libs\ImHttpRequest; class QueryPhone{ //3-2 API请求数据 const TAOBAO_API = 'https://tcc.taobao.com/cc/json/mobile_tel_segment.htm'; public static function query($phone){ //3-2 API请求数据 if (self::verifyPhone($phone)){ $response = ImHttpRequest::request(self::TAOBAO_API,['tel'=>$phone]); var_dump($response); } } }
    截图
    0赞 · 0采集
  • 林静听蝉 2016-03-03
    3-2 API请求数据 <?php /** * HTTP请求模块 */ namespace libs; class ImHttpRequest{ public static function request($url, $params, $method = 'GET'){ $response = null;//定义默认的返回值为null if ($url){ $method = strtoupper($method);//全转换为大写 if ($method == 'POST'){ }elseif ($method == 'PUT'){ }elseif ($method == 'DELETE'){ }else{ if (is_array($params) and count($params)){ if (strrpos($url, '?')) { $url = $url . '&' . http_build_query($params); }else{ $url = $url . '?' . http_build_query($params); } //var_dump($url); $response = file_get_contents($url); } } } //var_dump($response);//需要开启php/php.ini中的openssl扩展 return $response; } }
    截图
    0赞 · 0采集
  • forever大陆 2016-02-26
    ImHttpRequest.php
    截图
    0赞 · 0采集
  • forever大陆 2016-02-26
    检查手机合法&&引入API
    截图
    0赞 · 0采集
数据加载中...
开始学习 免费