首页 后端
  • PHP
  • Golang
  • Java
前端
  • JavaScript
  • CSS
数据库
  • MySQL
  • MongoDB
  • Redis
运维
  • Linux
  • BSD
  • Windows
  • Nginx
  • Raspberry
个人笔记 在线工具 关于

php下获取http状态码的实现代码

PHP9月18日暂无评论

整理了两种方式,大家可以自行参考/使用:

方式一
$ch = curl_init('http://www.jb51.net');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE); // 200
curl_close($ch);

QQ图片20150918213220.png

- 阅读全文 -

最新文章

  • Linux 创建 swap 交换分区
  • IDEA 创建 Spring Boot 笔记
  • 树莓派使用 PPTP 客户端连接 VPN
  • Redis 导出导入 hash 结构
  • Ubuntu 安装配置 supervisor
  • ubuntu下永久设置文件句柄数和虚拟内存
  • php7 + beanstalkd 生产环境队列使用姿势
  • 从 0 开始编译安装 swoole 示例
  • swoole安装异步redis –enable-async-redis出错 hiredis/hiredis.h: No such file or directory 解决方法
  • 编译安装swoole报错 "Enable http2 support, require nghttp2 library."

随机文章

  • PHP批量检测并去除文件BOM头代码实例
  • PHP批量修改文件名
  • 在WAMPSERVER下增加多版本的PHP(PHP5.3,PHP5.4,PHP5.5)支持
  • IIS配置php运行环境默认加载的php.ini路径
  • 日志文件分割(将大的日志文件分割成小的)
  • 根据两点间的经纬度计算距离
  • CSS截取多余字符,用省略号表示
  • Mysql开启慢查询记录耗时SQL语句
  • Nginx 502 upstream sent too big header while reading response header from upstream
  • 树莓派使用 PPTP 客户端连接 VPN

  • Warning: fwrite() expects parameter 1 to be resource, bool given in /www/wwwroot/yusure_blog/web/usr/plugins/RandomArticleList/Plugin.php on line 141

    Warning: fclose() expects parameter 1 to be resource, bool given in /www/wwwroot/yusure_blog/web/usr/plugins/RandomArticleList/Plugin.php on line 142

热门标签

  • PHP
  • mysql
  • curl
  • swoole
  • 采集
  • javascript
  • wamp
  • windows
  • sublime
  • nginx
  • html
  • 提取页面
  • 正则
  • 爬虫
  • http状态码
  • git
  • iis
  • win2003
  • linux
  • session