Subversion Repositories php-qbpwcf

Rev

Rev 81 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 81 Rev 226
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2025 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
11
    it under the terms of the GNU General Public License as published by
Line 31... Line 31...
31
namespace qbpwcf;
31
namespace qbpwcf;
32
 
32
 
33
#assets dir
33
#assets dir
34
$assetsDir="assets_of_javaScript::qbpwcfJavaScript_20250108";
34
$assetsDir="assets_of_javaScript::qbpwcfJavaScript_20250108";
35
 
35
 
36
#產生 qbpwcfJavaScript 
36
#產生 qbpwcfJavaScript
37
#函式說明:
37
#函式說明:
38
#建立qbpwcf專屬的js函式庫
38
#建立qbpwcf專屬的js函式庫
39
#回傳結果
39
#回傳結果
40
#$result["funciton"],當前函式的名稱.
40
#$result["funciton"],當前函式的名稱.
41
#$result["status"],執行的狀態,"true"代表正常,"false"代表不正常.
41
#$result["status"],執行的狀態,"true"代表正常,"false"代表不正常.
Line 57... Line 57...
57
if($qbpwcfJavaScript["status"]==="false")
57
if($qbpwcfJavaScript["status"]==="false")
58
{
58
{
59
 
59
 
60
	#show detail info
60
	#show detail info
61
	var_dump($qbpwcfJavaScript);
61
	var_dump($qbpwcfJavaScript);
62
	
62
 
63
	#結束執行,並回傳shell 1.
63
	#結束執行,並回傳shell 1.
64
	exit(1);
64
	exit(1);
65
 
65
 
66
}#if end
66
}#if end
67
 
67
 
Line 80... Line 80...
80
#$conf["script"],字串,要執行的javaScript語法.
80
#$conf["script"],字串,要執行的javaScript語法.
81
$conf["script"]="
81
$conf["script"]="
82
 
82
 
83
	//初始化參數
83
	//初始化參數
84
	var params={};
84
	var params={};
85
	
85
 
86
	//設定websocket位置
86
	//設定websocket位置
87
	params.url='wss://silverblue-guest.qbpwcf.org/wss';
87
	params.url='wss://silverblue-guest.qbpwcf.org/wss';
88
	
88
 
89
	//要傳輸的資料
89
	//要傳輸的資料
90
	params.data={};
90
	params.data={};
91
	
91
 
92
	//用來識別是所需要資料的id
92
	//用來識別是所需要資料的id
93
	params.data.id=crypto.randomUUID();
93
	params.data.id=crypto.randomUUID();
94
	
94
 
95
	//設置要用get
95
	//設置要用get
96
	params.data.Method='GET';
96
	params.data.Method='GET';
97
	
97
 
98
	//設置目標host
98
	//設置目標host
99
	params.data.Host='silverblue-guest.qbpwcf.org';
99
	params.data.Host='silverblue-guest.qbpwcf.org';
100
	
100
 
101
	//設置要抓取的檔案
101
	//設置要抓取的檔案
102
	params.data.File='index.php';
102
	params.data.File='index.php';
103
	
103
 
104
	//取得對應的回應
104
	//取得對應的回應
105
	var response=await window.qbpwcf.ws.init(params);
105
	var response=await window.qbpwcf.ws.init(params);
106
	
106
 
107
	//debug
107
	//debug
108
	console.log('after got response');
108
	console.log('after got response');
109
	
109
 
110
	//debug
110
	//debug
111
	console.log(response);
111
	console.log(response);
112
 
112
 
113
	";
113
	";
114
#可省略參數:
114
#可省略參數:
Line 130... Line 130...
130
#如果執行失敗
130
#如果執行失敗
131
if($toScript["status"]==="false"){
131
if($toScript["status"]==="false"){
132
 
132
 
133
	#show detail info
133
	#show detail info
134
	var_dump($toScript);
134
	var_dump($toScript);
135
	
135
 
136
	#結束執行,並回傳shell 1.
136
	#結束執行,並回傳shell 1.
137
	exit(1);
137
	exit(1);
138
 
138
 
139
	}#if end
139
	}#if end
140
 
140
 
141
#印出js語法
141
#印出js語法
142
echo $toScript["content"];
-
 
143
142
echo $toScript["content"];
-
 
143