AppHelper.php 1.41 KB
Newer Older
1
2
<?php
/**
Jenkins for ownCloud's avatar
Jenkins for ownCloud committed
3
 * @author Bart Visscher <bartv@thisnet.nl>
4
 * @author Lukas Reschke <lukas@owncloud.com>
Jenkins for ownCloud's avatar
Jenkins for ownCloud committed
5
6
 * @author Morris Jobke <hey@morrisjobke.de>
 *
Thomas Müller's avatar
Thomas Müller committed
7
 * @copyright Copyright (c) 2016, ownCloud, Inc.
Jenkins for ownCloud's avatar
Jenkins for ownCloud committed
8
9
10
11
12
13
14
15
16
17
18
19
20
 * @license AGPL-3.0
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
21
22
 *
 */
23

24
25
26
namespace OC;

/**
Lukas Reschke's avatar
Lukas Reschke committed
27
28
 * Class AppHelper
 * @deprecated 8.1.0
29
30
31
32
33
34
35
 */
class AppHelper implements \OCP\IHelper {
	/**
	 * Gets the content of an URL by using CURL or a fallback if it is not
	 * installed
	 * @param string $url the url that should be fetched
	 * @return string the content of the webpage
Lukas Reschke's avatar
Lukas Reschke committed
36
	 * @deprecated 8.1.0 Use \OCP\IServerContainer::getHTTPClientService
37
38
	 */
	public function getUrlContent($url) {
39
40
41
42
43
44
45
		try {
			$client = \OC::$server->getHTTPClientService()->newClient();
			$response = $client->get($url);
			return $response->getBody();
		} catch (\Exception $e) {
			return false;
		}
46
47
	}
}