Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
hfpp2012
/
vbot
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 465272aa
authored
Jan 23, 2017
by
HanSon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
get请求设置超时
1 parent
8ecc3db8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
src/Core/Http.php
src/Core/Sync.php
src/Core/Http.php
View file @
465272a
...
@@ -32,11 +32,15 @@ class Http
...
@@ -32,11 +32,15 @@ class Http
return
static
::
$instance
;
return
static
::
$instance
;
}
}
public
function
get
(
$url
,
array
$query
=
[])
public
function
get
(
$url
,
array
$query
=
[]
,
array
$options
=
[]
)
{
{
$query
=
$query
?
[
'query'
=>
$query
]
:
[];
if
(
$query
){
$options
[
'query'
]
=
$query
;
}
$options
[
'connect_timeout'
]
=
60
;
return
$this
->
request
(
$url
,
'GET'
,
$
query
);
return
$this
->
request
(
$url
,
'GET'
,
$
options
);
}
}
public
function
post
(
$url
,
$query
=
[],
$array
=
false
)
public
function
post
(
$url
,
$query
=
[],
$array
=
false
)
...
...
src/Core/Sync.php
View file @
465272a
...
@@ -32,7 +32,7 @@ class Sync
...
@@ -32,7 +32,7 @@ class Sync
]);
]);
try
{
try
{
$content
=
http
()
->
get
(
$url
,
[],
[
'connect_timeout'
=>
60
]
);
$content
=
http
()
->
get
(
$url
);
preg_match
(
'/window.synccheck=\{retcode:"(\d+)",selector:"(\d+)"\}/'
,
$content
,
$matches
);
preg_match
(
'/window.synccheck=\{retcode:"(\d+)",selector:"(\d+)"\}/'
,
$content
,
$matches
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment