Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
40dd5ae6
Commit
40dd5ae6
authored
12 years ago
by
thomas
Browse files
Options
Downloads
Patches
Plain Diff
change and transfert getUrlContent
parent
847467ab
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/ocsclient.php
+1
-21
1 addition, 21 deletions
lib/ocsclient.php
lib/util.php
+39
-0
39 additions, 0 deletions
lib/util.php
with
40 additions
and
21 deletions
lib/ocsclient.php
+
1
−
21
View file @
40dd5ae6
...
...
@@ -55,30 +55,10 @@ class OC_OCSClient{
* This function calls an OCS server and returns the response. It also sets a sane timeout
*/
private
static
function
getOCSresponse
(
$url
)
{
$data
=
self
::
fileGet
Content
Curl
(
$url
);
$data
=
\OC_Util
::
getUrl
Content
(
$url
);
return
(
$data
);
}
/**
* @Brief Get file content via curl.
* @return string of the response
* This function get the content of a page via curl.
*/
private
static
function
fileGetContentCurl
(
$url
){
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$curl
,
CURLOPT_CONNECTTIMEOUT
,
10
);
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
$data
=
curl_exec
(
$curl
);
curl_close
(
$data
);
return
$data
;
}
/**
* @brief Get all the categories from the OCS server
* @returns array with category ids
...
...
This diff is collapsed.
Click to expand it.
lib/util.php
+
39
−
0
View file @
40dd5ae6
...
...
@@ -642,4 +642,43 @@ class OC_Util {
return
false
;
}
/**
* @Brief Get file content via curl.
* @param string $url Url to get content
* @return string of the response
* This function get the content of a page via curl, if curl is enabled.
* If not, file_get_element is used.
*/
public
static
function
getUrlContent
(
$url
){
if
(
function_exists
(
'curl_init'
))
{
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$curl
,
CURLOPT_CONNECTTIMEOUT
,
10
);
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
$data
=
curl_exec
(
$curl
);
curl_close
(
$data
);
}
else
{
$ctx
=
stream_context_create
(
array
(
'http'
=>
array
(
'timeout'
=>
10
)
)
);
$data
=@
file_get_contents
(
$url
,
0
,
$ctx
);
}
return
(
$data
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment