🧑🏻‍💻 博世

[zz.ac]部署高清壁纸站点

CT8高清壁纸站

登陆zz.ac运行php-v :

php -v
        PHP 8.4.5 (cli) (built: Mar 17 2025 20:35:32) (NTS)
        Copyright (c) The PHP Group
        Zend Engine v4.4.5, Copyright (c) Zend Technologies
            with Zend OPcache v8.4.5, Copyright (c), by Zend Technologies

看来zz.ac主机上已经默认安装了php ## 上传源码: 建立文件夹,上传源码并解压:

mkdir -p pictrues

        cd pictrues/

        unzip pic.zip 

        rm YYDS源码网.html 必读资源说明.txt 
        

运行服务器

 php -S localhost:9000
        [Thu Jan  8 02:07:38 2026] PHP 8.4.5 Development Server (http://localhost:9000) started

设置域名

登陆https://desec.io/domains,设置域名解析:

image.png

设置caddy反代:

在Caddyfile文件中加入一下内容:

http://pic.bosh.zz.ac:8080 {
             reverse_proxy 127.0.0.1:9000
        }

重新启动caddy 服务:

systemctl --user restart caddy

访问https://pic.bosh.zz.ac/,网页界面显示:

努力加载中,但是却没有出来图片。 > 我想起来了应该还是代理的问题,查看后台php运行日志:

bosh@h1:~/pictrues$ php -S localhost:9000
        [Thu Jan  8 02:07:38 2026] PHP 8.4.5 Development Server (http://localhost:9000) started
        [Thu Jan  8 02:14:32 2026] 127.0.0.1:51104 Accepted
        [Thu Jan  8 02:14:32 2026] 127.0.0.1:51104 [200]: GET /
        [Thu Jan  8 02:14:32 2026] 127.0.0.1:51104 Closing
        [Thu Jan  8 02:14:32 2026] 127.0.0.1:51114 Accepted
        [Thu Jan  8 02:14:32 2026] 127.0.0.1:51114 [200]: GET /css/wallpaper.css
        [Thu Jan  8 02:14:32 2026] 127.0.0.1:51114 Closing
        [Thu Jan  8 02:14:32 2026] 127.0.0.1:51126 Accepted
        [Thu Jan  8 02:14:32 2026] 127.0.0.1:51126 [200]: GET /js/jquery.lazyload.min.js
        [Thu Jan  8 02:14:32 2026] 127.0.0.1:51126 Closing
        [Thu Jan  8 02:14:33 2026] 127.0.0.1:51140 Accepted
        [Thu Jan  8 02:14:33 2026] 127.0.0.1:51140 [200]: GET /js/jquery.onepage-scroll.min.js
        [Thu Jan  8 02:14:33 2026] 127.0.0.1:51140 Closing
        [Thu Jan  8 02:14:33 2026] 127.0.0.1:51142 Accepted
        [Thu Jan  8 02:14:33 2026] 127.0.0.1:51142 [200]: GET /js/wallpaper.js
        [Thu Jan  8 02:14:33 2026] 127.0.0.1:51142 Closing
        [Thu Jan  8 02:14:34 2026] 127.0.0.1:51154 Accepted
        [Thu Jan  8 02:14:34 2026] PHP Warning:  file_get_contents(): php_network_getaddresses: getaddrinfo for wp.birdpaper.com.cn failed: Name or service not known in /home/bosh/pictrues/api.php on line 13
        [Thu Jan  8 02:14:34 2026] PHP Warning:  file_get_contents(http://wp.birdpaper.com.cn/intf/getCategory): Failed to open stream: php_network_getaddresses: getaddrinfo for wp.birdpaper.com.cn failed: Name or service not known in /home/bosh/pictrues/api.php on line 13
        ........

果然:Name or service not known in /home/bosh/pictrues/api.php on line 13

尝试加上代理运行:

http_proxy="http://[fe80::1%25eth0]:8888" https_proxy="http://[fe80::1%25eth0]:8888" php -S 0.0.0.0:9000

刷新网页还是努力加载中但是加载不出来。 ## 是时候搬出AI大师了! 经过咨询,让AI修改了api.php:

<?php

        // --- 配置区 ---
        // 注意:在代码中,IPv6 的作用域标识通常直接使用 %eth0,而不是命令行里的 %25eth0
        $proxy_url = "tcp://[fe80::1%eth0]:8888"; 
        // --------------

        $cid = getParam('cid', '360new');

        switch($cid)
        {
            case '360new':  // 360壁纸 新图片
                $start = getParam('start', 0);
                $count = getParam('count', 10);
                $url = "http://wp.birdpaper.com.cn/intf/newestList?pageno={$start}&count={$count}";
                echojson(fetchData($url, $proxy_url));
            break;

            case '360tags':
                $url = "http://wp.birdpaper.com.cn/intf/getCategory";
                echojson(fetchData($url, $proxy_url));
            break;
            
            case 'bing':
                $start = getParam('start', -1);
                $count = getParam('count', 8);
                $url = "http://cn.bing.com/HPImageArchive.aspx?format=js&idx={$start}&n={$count}";
                echojson(fetchData($url, $proxy_url));
            break;
            
            case '360search':
                $content = getParam('content', '');
                $start = getParam('start', 0);
                $count = getParam('count', 10);
                $url = "http://wp.birdpaper.com.cn/intf/search?content={$content}&pageno={$start}&count={$count}";
                echojson(fetchData($url, $proxy_url));
            break;
            
            default:
                $start = getParam('start', 0);
                $count = getParam('count', 10);
                $url = "http://wp.birdpaper.com.cn/intf/GetListByCategory?cids={$cid}&pageno={$start}&count={$count}";
                echojson(fetchData($url, $proxy_url));
        }

        /**
         * 核心修复:通过代理获取远程数据
         */
        function fetchData($url, $proxy)
        {
            $opts = [
                "http" => [
                    "proxy" => $proxy,
                    "request_fulluri" => true,
                    "timeout" => 10, // 设置10秒超时
                    "header" => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\r\n"
                ]
            ];
            
            $context = stream_context_create($opts);
            
            // 使用 @ 符号抑制警告,通过返回值判断错误
            $result = @file_get_contents($url, false, $context);
            
            if ($result === false) {
                // 如果失败,返回一个标准的 JSON 错误提示
                return json_encode(["error" => "无法连接远程服务器", "debug_url" => $url]);
            }
            
            return $result;
        }

        /**
         * 获取GET或POST过来的参数
         */
        function getParam($key, $default='')
        {
            return trim($key && is_string($key) ? (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $default)) : $default);
        }

        /**
         * 输出内容
         */
        function echojson($data)
        {
            header('Content-Type: application/json; charset=utf-8');
            echo $data;
        }

再次运行:

php -S localhost:9000

刷新网页,成功加载!

截图_2026-01-08_10-39-39.png # 大功告成 :smile:

修改后的源码