Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
X Lib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
XLibs
X Lib
Commits
d6591570
Commit
d6591570
authored
Jul 12, 2016
by
Alex Ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add vk api
parent
d9a83f09
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
ClientResponse.php
Network/Http/ClientResponse.php
+1
-1
ClientSettings.php
Network/Http/ClientSettings.php
+5
-1
VK.php
Social/VK.php
+20
-2
No files found.
Network/Http/ClientResponse.php
View file @
d6591570
...
...
@@ -48,7 +48,7 @@ class ClientResponse {
return
$this
->
body
;
}
public
function
get_json
()
{
public
function
json_decode
()
{
return
json_decode
(
$this
->
body
,
true
);
}
}
...
...
Network/Http/ClientSettings.php
View file @
d6591570
...
...
@@ -52,8 +52,8 @@ class ClientSettings {
$this
->
data
[
"get"
]
=
$out
;
}
}
return
$this
;
}
return
$this
;
}
/**
...
...
@@ -93,6 +93,7 @@ class ClientSettings {
if
(
isset
(
$data
[
"timeout"
]))
{
$this
->
data
[
"timeout"
]
=
intval
(
$data
[
"timeout"
])
?:
10
;
}
return
$this
;
}
/**
...
...
@@ -101,6 +102,7 @@ class ClientSettings {
*/
public
function
add_getvar
(
$name
,
$value
)
{
$this
->
data
[
"get"
][
$name
]
=
$value
;
return
$this
;
}
/**
...
...
@@ -109,6 +111,7 @@ class ClientSettings {
*/
public
function
add_postvar
(
$name
,
$value
)
{
$this
->
data
[
"post"
][
$name
]
=
$value
;
return
$this
;
}
/**
...
...
@@ -116,6 +119,7 @@ class ClientSettings {
*/
public
function
set_putvar
(
$value
)
{
$this
->
data
[
"put"
]
=
$value
;
return
$this
;
}
protected
function
build_url
()
{
...
...
Social/VK.php
View file @
d6591570
...
...
@@ -2,6 +2,24 @@
namespace
X\Social
;
class
VK
{
/**
* @var string
*/
protected
$api_url
=
""
;
}
?>
\ No newline at end of file
public
function
__construct
()
{}
/**
* @param string $method
* @param array $params
*/
public
function
api
(
$method
,
$params
=
[])
{
$Client
=
new
X\Network\Http\Client
(
$this
->
api_url
.
"/"
.
$method
);
$Client
->
set_model_data
([
"post"
=>
$params
]);
if
(
$data
=
$Client
->
exec
()
->
json_decode
())
{
return
$data
;
}
return
;
}
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment