当前位置:首页 » 操作系统 » https源码

https源码

发布时间: 2023-10-28 22:03:18

‘壹’ php怎么抓取这个链接https://locate.apple.com/cn/zh/service/pt=3&lat=23.134521&lon=113.358803的源码

<?php
function dg_string($data,$flagA, $flagB, $start = 0){//配套截取字符串
$flagAL=strlen($flagA);
$flagBL=strlen($flagB);
$rn='';
$a=$b=0;
if(($findA=strpos($data,$flagA, $start))!==false){
$a=1;
$tmpA=$findA;
$findB=$findA+$flagAL;
$findA=$findB;
while($a!=$b){
if(($findB = strpos($data, $flagB, $findB))!==false){
$b++;
if(($findA = strpos($data, $flagA, $findA))!==false){
if($findA>$findB){
if($a==$b){
//结束
$findB+=$flagBL;
$rn=substr($data,$tmpA,$findB-$tmpA);
} else {
$a++;
$findB=$findA+$flagAL;
$findA=$findB;
}
} else {
$a++;
$findA+=$flagAL;
$findB+=$flagBL;
}
} else {
if($a==$b){
//结束
$findB+=$flagBL;
$rn=substr($data,$tmpA,$findB-$tmpA);
} else {
//标记不完整
$findB+=$flagBL;
}
}
} else {
//标记不完整
$rn=substr($data,$tmpA);
$rn.=str_repeat($flagB,$a-$b);
break;
}
}
}
return $rn;
}
$html = file_get_contents('https://locate.apple.com/cn/zh/service/?pt=3&lat=23.134521&lon=113.358803');//获取源码
$find = strpos($html, 'window.resourceLocator.setup');
$json1 = dg_string($html, '{', '}', $find);//获取第一个JSON数据
$find = strpos($html, 'window.resourceLocator.storeSetup');
$json2 = dg_string($html, '{', '}', $find);//获取第二个JSON数据
$arr1 = json_decode($json1, true);//第一个JSON数据转为数组
$arr2 = json_decode($json2, true);//第二个JSON数据转为数组
print_r($arr1);
print_r($arr2);
//得到了数组,你想获取哪个参数都行了,你自己看着办吧,楼主可亲测代码
?>

‘贰’ https访问php直接显示源码是什么问题

HTTPS配置错误,导致的环境没有正常显示,请重新配置。
配置教程:https://www.gworg.com/ssl/127.html

热点内容
手机视频怎样压缩最小 发布:2025-09-13 13:20:13 浏览:249
java编程思想第五版 发布:2025-09-13 13:06:08 浏览:406
手机禁止程序访问网络连接网络连接 发布:2025-09-13 13:06:07 浏览:342
以钛算法 发布:2025-09-13 12:52:08 浏览:907
安卓手机怎么安装多个淘宝app 发布:2025-09-13 12:50:49 浏览:980
win10系统如何查看wifi密码 发布:2025-09-13 12:37:14 浏览:305
探岳两驱豪华版哪个配置好 发布:2025-09-13 12:34:53 浏览:829
java上传图片插件 发布:2025-09-13 12:31:54 浏览:361
b站直接上传 发布:2025-09-13 12:28:56 浏览:878
为什么中国考试网提示密码错误 发布:2025-09-13 12:21:25 浏览:415