Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
57a53f43
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
9 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
57a53f43
编写于
10月 10, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test scripts
上级
1913efad
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
48 addition
and
40 deletion
+48
-40
demo/lang/javascript/2_webpage_extract.js
demo/lang/javascript/2_webpage_extract.js
+6
-7
demo/lang/javascript/3_http_inteface_call.js
demo/lang/javascript/3_http_inteface_call.js
+5
-5
demo/lang/perl/2_webpage_extract.pl
demo/lang/perl/2_webpage_extract.pl
+3
-3
demo/lang/perl/3_http_interface_call.pl
demo/lang/perl/3_http_interface_call.pl
+3
-3
demo/lang/php/2_webpage_extract.php
demo/lang/php/2_webpage_extract.php
+3
-3
demo/lang/php/3_http_interface_call.php
demo/lang/php/3_http_interface_call.php
+3
-3
demo/lang/python/2_webpage_extract.py
demo/lang/python/2_webpage_extract.py
+3
-3
demo/lang/python/3_http_interface_call.py
demo/lang/python/3_http_interface_call.py
+3
-3
demo/lang/tcl/2_webpage_extract.tl
demo/lang/tcl/2_webpage_extract.tl
+6
-3
demo/lang/tcl/3_http_interface_call.tl
demo/lang/tcl/3_http_interface_call.tl
+13
-7
未找到文件。
demo/lang/javascript/2_webpage_extract.js
浏览文件 @
57a53f43
...
...
@@ -6,23 +6,22 @@ pid=0
1. Load web page from url http://xxx
2. Retrieve img element zt-logo.png in html
3. Check img exist >> `
.*.png
`
3. Check img exist >> `
必应
`
*/
var
http
=
require
(
'
http
'
);
const
https
=
require
(
'
https
'
);
http
.
get
(
'
http://max.demo.zentao.net/user-login-Lw==.html
'
,
function
(
req
)
{
let
html
=
''
,
image
=
''
;
http
s
.
get
(
'
https://cn.bing.com
'
,
function
(
req
)
{
let
html
=
''
req
.
on
(
'
data
'
,
function
(
data
)
{
html
+=
data
;
});
req
.
on
(
'
end
'
,
()
=>
{
var
res
=
html
.
match
(
/<img
\s
src="
(
.*
?)
"
/
);
const
res
=
html
.
match
(
/<title>
(
.*
?)
<
/
);
if
(
res
.
length
>
1
)
{
image
=
res
[
1
]
console
.
log
(
image
)
console
.
log
(
res
[
1
])
}
});
});
demo/lang/javascript/3_http_inteface_call.js
浏览文件 @
57a53f43
...
...
@@ -6,13 +6,13 @@ pid=0
1. Send a request to interface http://xxx
2. Retrieve sessionID field from response json
3. Validate its format >> `^[a-z0-9]{
26
}`
3. Validate its format >> `^[a-z0-9]{
8
}`
*/
var
http
=
require
(
'
http
'
);
const
https
=
require
(
'
https
'
);
http
.
get
(
'
http://max.demo.zentao.net/pms/?mode=getconfig
'
,
function
(
req
)
{
http
s
.
get
(
'
https://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1
'
,
function
(
req
)
{
let
jsonStr
=
''
;
req
.
on
(
'
data
'
,
function
(
data
)
{
...
...
@@ -21,8 +21,8 @@ http.get('http://max.demo.zentao.net/pms/?mode=getconfig', function(req) {
req
.
on
(
'
end
'
,
()
=>
{
if
(
req
.
statusCode
===
200
){
try
{
var
json
=
JSON
.
parse
(
jsonStr
);
console
.
log
(
json
.
sessionID
)
const
json
=
JSON
.
parse
(
jsonStr
);
console
.
log
(
json
.
images
[
0
].
startdate
)
}
catch
(
err
){
console
.
log
(
'
ERR:
'
+
err
);
}
...
...
demo/lang/perl/2_webpage_extract.pl
浏览文件 @
57a53f43
...
...
@@ -6,13 +6,13 @@ pid=0
1. Load web page from url http://xxx
2. Retrieve img element zt-logo.png in html
3. Check img exist >> `
.*zt-logo.png
`
3. Check img exist >> `
必应
`
=cut
use
LWP::
Simple
;
# need LWP::Simple module
$html
=
get
('
http
://max.demo.zentao.net/user-login-Lw==.html
');
$html
=
get
('
http
s://cn.bing.com
');
if
(
$html
=~
/<
img src="(.*?)" .*>
/
)
{
if
(
$html
=~
/<
title>(.*?)<
/
)
{
print
"
$1
\n
";
}
demo/lang/perl/3_http_interface_call.pl
浏览文件 @
57a53f43
...
...
@@ -7,13 +7,13 @@ pid=0
1. Send a request to interface http://xxx
2. Retrieve sessionID field from response json
3. Check its format >> `^[a-z0-9]{
26
}`
3. Check its format >> `^[a-z0-9]{
8
}`
=cut
use
LWP::
Simple
;
# need LWP::Simple module
$json
=
get
('
http
://max.demo.zentao.net/pms/?mode=getconfig
');
$json
=
get
('
http
s://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1
');
if
(
$json
=~
/"s
essionID
":"([^"]*)"/
)
{
if
(
$json
=~
/"s
tartdate
":"([^"]*)"/
)
{
print
"
$1
\n
";
}
demo/lang/php/2_webpage_extract.php
浏览文件 @
57a53f43
...
...
@@ -8,10 +8,10 @@ pid=0
1. Load web page from url http://xxx
2. Retrieve img element zt-logo.png in html
3. Check img exist >> `
.*zt-logo.png
`
3. Check img exist >> `
必应
`
*/
$resp
=
file_get_contents
(
'http
://max.demo.zentao.net/user-login-Lw==.html
'
);
preg_match_all
(
"/<
img src=
\"
(.*)
\"
.*>
/U"
,
$resp
,
$matches
);
$resp
=
file_get_contents
(
'http
s://cn.bing.com
'
);
preg_match_all
(
"/<
title>(.*)<
/U"
,
$resp
,
$matches
);
echo
$matches
[
1
][
0
]
.
"
\n
"
;
demo/lang/php/3_http_interface_call.php
浏览文件 @
57a53f43
...
...
@@ -8,10 +8,10 @@ pid=0
1. Send a request to interface http://xxx
2. Retrieve sessionID field from response json
3. Check its format >> `^[a-z0-9]{
26
}`
3. Check its format >> `^[a-z0-9]{
8
}`
*/
$resp
=
file_get_contents
(
'http
://max.demo.zentao.net/pms/?mode=getconfig
'
);
$resp
=
file_get_contents
(
'http
s://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1
'
);
$json
=
json_decode
(
$resp
);
echo
$json
->
sessionID
.
"
\n
"
;
echo
$json
->
images
[
0
]
->
startdate
.
"
\n
"
;
demo/lang/python/2_webpage_extract.py
浏览文件 @
57a53f43
...
...
@@ -8,13 +8,13 @@ pid=0
1. Load web page from url http://xxx
2. Retrieve img element zt-logo.png in html
3. Check img exist >> `
.*zt-logo.png
`
3. Check img exist >> `
必应
`
'''
import
requests
import
re
html
=
requests
.
get
(
'http
://max.demo.zentao.net/user-login-Lw==.html
'
).
content
#need requests library (pip/pip3 install requests)
elem
=
re
.
search
(
r
"<
img src=\"(.*?)\" .*>
"
,
html
.
decode
(
"utf-8"
)).
group
(
1
)
html
=
requests
.
get
(
'http
s://cn.bing.com
'
).
content
#need requests library (pip/pip3 install requests)
elem
=
re
.
search
(
r
"<
title>(.*?)<
"
,
html
.
decode
(
"utf-8"
)).
group
(
1
)
print
(
elem
)
demo/lang/python/3_http_interface_call.py
浏览文件 @
57a53f43
...
...
@@ -8,13 +8,13 @@ pid=0
1. Send a request to interface http://xxx
2. Retrieve sessionID field from response json
3. Check its format >> `^[a-z0-9]{
26
}`
3. Check its format >> `^[a-z0-9]{
8
}`
'''
import
requests
import
json
jsonStr
=
requests
.
get
(
'http
://max.demo.zentao.net/pms/?mode=getconfig'
).
content
#need requests library (pip/pip3 install requests)
jsonStr
=
requests
.
get
(
'http
s://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1'
).
content
jsonObj
=
json
.
loads
(
jsonStr
)
print
(
jsonObj
[
'
sessionID
'
])
print
(
jsonObj
[
'
images'
][
0
][
'startdate
'
])
demo/lang/tcl/2_webpage_extract.tl
浏览文件 @
57a53f43
...
...
@@ -7,16 +7,19 @@ pid=0
1.
Load
web
page
from
url
http
://
xxx
2.
Retrieve
img
element
zt
-
logo
.
png
in
html
3.
Check
img
exist
>>
`
.*
zt
-
logo
.
png
`
3.
Check
img
exist
>>
`
必应
`
}
package
require
http
package
require
tls
set
url
http
://
max
.
demo
.
zentao
.
net
/
user
-
login
-
Lw
==.
html
http
::
register
https
443
tls
::
socket
set
url
https
://
cn
.
bing
.
com
set
http
[::
http
::
geturl
$
url
]
set
html
[::
http
::
data
$
http
]
regexp
--
{<
img
src
=
"(.*?)"
.*>
}
$
html
match
elem
regexp
--
{<
title
>(.*?)<
}
$
html
match
elem
puts
"$elem"
demo/lang/tcl/3_http_interface_call.tl
浏览文件 @
57a53f43
...
...
@@ -5,20 +5,26 @@ title=check remote interface response
cid
=
0
pid
=
0
1.
Send
a
request
to
interface
http
://
xxx
2.
Retrieve
sessionID
field
from
response
json
3.
Check
its
format
>>
`^[
a
-
z0
-
9
]{
26
}`
1.
Send
a
request
to
interface
http
://
xxx
2.
Retrieve
sessionID
field
from
response
json
3.
Check
its
format
>>
`^[
a
-
z0
-
9
]{
8
}`
}
package
require
http
package
require
tls
package
require
json
set
url
http
://
max
.
demo
.
zentao
.
net
/
pms
/?
mode
=
getconfig
http
::
register
https
443
tls
::
socket
set
url
https
://
cn
.
bing
.
com
/
HPImageArchive
.
aspx
?
format
=
js
&
idx
=
0
&
n
=
1
set
http
[::
http
::
geturl
$
url
]
set
jsonStr
[::
http
::
data
$
http
]
#
need
json
library
,
you
may
use
ActiveTcl
set
jsonObj
[
json
::
json2dict
$
jsonStr
]
puts
"[dict get $jsonObj sessionID]"
regexp
--
{
"startdate"
:
"(.*?)"
}
$
jsonStr
match
date
puts
"$date"
#
set
jsonObj
[
json
::
json2dict
$
jsonStr
]
#
set
images
[
dict
get
$
jsonObj
images
]
#
puts
[
dict
get
$
images
startdate
]
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录