1.curl获取的web content 不能直接echo到页面,会造成js各种错误

2.想办法处理字符串的截取、拼接

2.1.裁剪html返回的字符串

function cutStringFrom($mainStr,$toCunSampleStr){
// 保存要被裁剪的字符串
$cuttedStr = $mainStr;
// 要裁剪的字符串样本
$targetString = $toCunSampleStr;
// 先找到 样本字符串 位置
$index = strpos($cuttedStr,$targetString);
// 样本字符串长度
$targetStringLength = strlen($targetString);
// 开始截断
$cuttedStr = substr($cuttedStr,$index + $targetStringLength);
// 返回截断后结果
return $cuttedStr;
}

2.2.从字符串的最前面两个双引号之前取出数值

function getStringBetweenDoubleMarks($mainStr){
// 保存要查找内容的原字符串
$cuttedStr = $mainStr;
// 找到第一个"
$strRemovedFirstMark = cutStringFrom($cuttedStr,"\"");
$indexNextMark = strpos($strRemovedFirstMark,"\"");
$valueBetweenDoubuleMark = substr($strRemovedFirstMark,0,$indexNextMark);
return $valueBetweenDoubuleMark;
}

2.3获取设备呼叫统计参数

function getCallSummary($html){
$htmlContent = $html;
$propertyValue = array();
$propertyName = array("g_WebPort","kIpAddress","sysName","CALLTIME","CALLTOTALNUMBER","IPCALLTOTALNUMBER","IPCALLTOTALTIME","PERCENT_IP_CALLS","ISDNCALLTOTALNUMBER","ISDNCALLTOTALTIME","PERCENT_ISDN_CALLS");
foreach ($propertyName as $value){
$htmlContent = cutStringFrom($htmlContent,$value);
$propertyValue[] = getStringBetweenDoubleMarks($htmlContent);
}
return $propertyValue;
}

最新文章

  1. 如何有效使用Project(2)——进度计划的执行与监控
  2. Mock模拟后台数据接口--再也不用等后端的API啦
  3. 在C#中读写INI配置文件(转)
  4. Asp.net MVC中的ViewData与ViewBag
  5. [ES6] 20. Polyfills
  6. C# 图解教程 第五章 方法
  7. MongoDb进阶实践之七 MongoDB的索引入门
  8. C#winform窗口登录和数据的增删改查
  9. python验证码识别接口及识别思路代码
  10. 【codeforces】【Round#523D】TV shows
  11. [Agc005D]K Perm Counting
  12. redmine一键安装(项目管理、Bug管理、任务跟踪、代码管理、日报等等)
  13. 用Telnet测试服务器的端口是否开通
  14. Netty 零拷贝(一)NIO 对零拷贝的支持
  15. 201709013工作日记--Android消息机制HandlerThread
  16. ubuntu server 安装nextcloud12
  17. 手机端全局样式表整理(mobile)
  18. 课堂实验-Bag
  19. [svc]entrypoint.sh shell脚本解析
  20. 编写高质量代码改善C#程序的157个建议——建议92:谨慎将数组或集合作为属性

热门文章

  1. 使用Python的Flask框架,结合Highchart,动态渲染图表(Ajax 请求数据接口)
  2. Scrapy实战:使用scrapy再再次爬取干货集中营的妹子图片
  3. defer, panic, recover使用总结
  4. 【tips】ORM - SQLAlchemy操作MySQL数据库
  5. GeoTrust 企业(OV)型 增强版(EV) SSL证书
  6. Android学习总结(5)——9个非常有用的Andorid 程序片段
  7. hdu 4941 stl的map<node,int>用法
  8. readl()和writel()
  9. Spring MVC-集成(Integration)-生成RSS源示例(转载实践)
  10. N天学习一个Linux命令之free