本文整理汇总了PHP中download_file_content函数的典型用法代码示例。如果您正苦于以下问题:PHP download_file_content函数的具体用法?PHP download_file_content怎么用?PHP download_file_content使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了download_file_content函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call
/**
* Execute client WS request with token authentication
* @param string $functionname
* @param array $params
* @return mixed
*/
public function call($functionname, $params)
{
global $DB, $CFG;
$result = download_file_content($this->serverurl . '?wstoken=' . $this->token . '&wsfunction=' . $functionname, null, $params);
//TODO : transform the XML result into PHP values - MDL-22965
return $result;
}
示例2: iplookup_find_location
/**
* Returns location information
* @param string $ip
* @return array
*/
function iplookup_find_location($ip)
{
global $CFG;
$info = array('city' => null, 'country' => null, 'longitude' => null, 'latitude' => null, 'error' => null, 'note' => '', 'title' => array());
if (!empty($CFG->geoip2file) and file_exists($CFG->geoip2file)) {
$reader = new GeoIp2\Database\Reader($CFG->geoip2file);
$record = $reader->city($ip);
if (empty($record)) {
$info['error'] = get_string('iplookupfailed', 'error', $ip);
return $info;
}
$info['city'] = core_text::convert($record->city->name, 'iso-8859-1', 'utf-8');
$info['title'][] = $info['city'];
$countrycode = $record->country->isoCode;
$countries = get_string_manager()->get_list_of_countries(true);
if (isset($countries[$countrycode])) {
// Prefer our localized country names.
$info['country'] = $countries[$countrycode];
} else {
$info['country'] = $record->country->names['en'];
}
$info['title'][] = $info['country'];
$info['longitude'] = $record->location->longitude;
$info['latitude'] = $record->location->latitude;
$info['note'] = get_string('iplookupmaxmindnote', 'admin');
return $info;
} else {
require_once $CFG->libdir . '/filelib.php';
if (strpos($ip, ':') !== false) {
// IPv6 is not supported by geoplugin.net.
$info['error'] = get_string('invalidipformat', 'error');
return $info;
}
$ipdata = download_file_content('http://www.geoplugin.net/json.gp?ip=' . $ip);
if ($ipdata) {
$ipdata = preg_replace('/^geoPlugin\\((.*)\\)\\s*$/s', '$1', $ipdata);
$ipdata = json_decode($ipdata, true);
}
if (!is_array($ipdata)) {
$info['error'] = get_string('cannotgeoplugin', 'error');
return $info;
}
$info['latitude'] = (double) $ipdata['geoplugin_latitude'];
$info['longitude'] = (double) $ipdata['geoplugin_longitude'];
$info['city'] = s($ipdata['geoplugin_city']);
$countrycode = $ipdata['geoplugin_countryCode'];
$countries = get_string_manager()->get_list_of_countries(true);
if (isset($countries[$countrycode])) {
// prefer our localized country names
$info['country'] = $countries[$countrycode];
} else {
$info['country'] = s($ipdata['geoplugin_countryName']);
}
$info['note'] = get_string('iplookupgeoplugin', 'admin');
$info['title'][] = $info['city'];
$info['title'][] = $info['country'];
return $info;
}
}
示例3: bootstrap
function bootstrap($wwwroot, $pubkey = null, $application)
{
global $DB;
if (substr($wwwroot, -1, 1) == '/') {
$wwwroot = substr($wwwroot, 0, -1);
}
// If a peer record already exists for this address,
// load that info and return
if ($this->set_wwwroot($wwwroot)) {
return true;
}
$hostname = mnet_get_hostname_from_uri($wwwroot);
// Get the IP address for that host - if this fails, it will return the hostname string
$ip_address = gethostbyname($hostname);
// Couldn't find the IP address?
if ($ip_address === $hostname && !preg_match('/^\\d+\\.\\d+\\.\\d+.\\d+$/', $hostname)) {
throw new moodle_exception('noaddressforhost', 'mnet', '', $hostname);
}
$this->name = $wwwroot;
// TODO: In reality, this will be prohibitively slow... need another
// default - maybe blank string
$homepage = download_file_content($wwwroot);
if (!empty($homepage)) {
$count = preg_match("@<title>(.*)</title>@siU", $homepage, $matches);
if ($count > 0) {
$this->name = $matches[1];
}
}
$this->wwwroot = $wwwroot;
$this->ip_address = $ip_address;
$this->deleted = 0;
$this->application = $DB->get_record('mnet_application', array('name' => $application));
if (empty($this->application)) {
$this->application = $DB->get_record('mnet_application', array('name' => 'moodle'));
}
$this->applicationid = $this->application->id;
if (empty($pubkey)) {
$this->public_key = clean_param(mnet_get_public_key($this->wwwroot, $this->application), PARAM_PEM);
} else {
$this->public_key = clean_param($pubkey, PARAM_PEM);
}
$this->public_key_expires = $this->check_common_name($this->public_key);
$this->last_connect_time = 0;
$this->last_log_id = 0;
if ($this->public_key_expires == false) {
$this->public_key == '';
return false;
}
$this->bootstrapped = true;
}
示例4: xmldb_theme_afterburner_upgrade
/**
* Afterburner upgrades.
*
* @package theme_afterburner
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function xmldb_theme_afterburner_upgrade($oldversion) {
global $CFG, $DB, $OUTPUT;
$dbman = $DB->get_manager();
if ($oldversion < 2013041200) {
// Migrate logo URL.
$logo = get_config('theme_afterburner', 'logo');
if ($logo === '') {
// No logo means nothing to do.
} else if ($logo = clean_param($logo, PARAM_URL)) {
require_once("$CFG->libdir/filelib.php");
if ($content = download_file_content($logo)) {
$filename = preg_replace('/^.*\//', '', $logo);
if (!$filename = clean_param($filename, PARAM_FILE)) {
// Some name is better than no name...
$filename = 'logo.jpg';
}
$fs = get_file_storage();
$record = array(
'contextid' => context_system::instance()->id, 'component' => 'theme_afterburner',
'filearea' => 'logo', 'itemid'=>0, 'filepath'=>'/', 'filename'=>$filename);
$fs->create_file_from_string($record, $content);
set_config('logo', '/'.$filename, 'theme_afterburner');
unset($content);
} else {
unset_config('theme_afterburner', 'logo');
}
} else {
// Prompt for new logo, the old setting was invalid.
unset_config('theme_afterburner', 'logo');
}
upgrade_plugin_savepoint(true, 2013041200, 'theme', 'afterburner');
}
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例5: call
/**
* Execute client WS request with token authentication
*
* @param string $functionname the function name
* @param array $params An associative array containing the the parameters of the function being called.
* @return mixed The decoded XML RPC response.
* @throws moodle_exception
*/
public function call($functionname, $params = array())
{
if ($this->token) {
$this->serverurl->param('wstoken', $this->token);
}
// Set output options.
$outputoptions = array('encoding' => 'utf-8');
// Encode the request.
$request = xmlrpc_encode_request($functionname, $params, $outputoptions);
// Set the headers.
$headers = array('Content-Length' => strlen($request), 'Content-Type' => 'text/xml; charset=utf-8', 'Host' => $this->serverurl->get_host(), 'User-Agent' => 'Moodle XML-RPC Client/1.0');
// Get the response.
$response = download_file_content($this->serverurl, $headers, $request);
// Decode the response.
$result = xmlrpc_decode($response);
if (is_array($result) && xmlrpc_is_fault($result)) {
throw new Exception($result['faultString'], $result['faultCode']);
}
return $result;
}
示例6: call
/**
* Execute client WS request with token authentication
*
* @param string $functionname the function name
* @param array $params the parameters of the function
* @return mixed
*/
public function call($functionname, $params)
{
global $DB, $CFG;
if ($this->format == 'json') {
$formatparam = '&moodlewsrestformat=json';
$this->serverurl->param('moodlewsrestformat', 'json');
} else {
$formatparam = '';
//to keep retro compability with old server that only support xml (they don't expect this param)
}
$this->serverurl->param('wstoken', $this->token);
$this->serverurl->param('wsfunction', $functionname);
//you could also use params().
$result = download_file_content($this->serverurl->out(false), null, $params);
//TODO MDL-22965 transform the XML result into PHP values
if ($this->format == 'json') {
$result = json_decode($result);
}
return $result;
}
示例7: test_geoip
public function test_geoip()
{
global $CFG;
require_once "{$CFG->libdir}/filelib.php";
require_once "{$CFG->dirroot}/iplookup/lib.php";
if (!PHPUNIT_LONGTEST) {
// this may take a long time
return;
}
$this->resetAfterTest();
// let's store the file somewhere
$gzfile = "{$CFG->dataroot}/phpunit/geoip/GeoLiteCity.dat.gz";
check_dir_exists(dirname($gzfile));
if (file_exists($gzfile) and filemtime($gzfile) < time() - 60 * 60 * 24 * 30) {
// delete file if older than 1 month
unlink($gzfile);
}
if (!file_exists($gzfile)) {
download_file_content('http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz', null, null, false, 300, 20, false, $gzfile);
}
$this->assertTrue(file_exists($gzfile));
$zd = gzopen($gzfile, "r");
$contents = gzread($zd, 50000000);
gzclose($zd);
$geoipfile = "{$CFG->dataroot}/geoip/GeoLiteCity.dat";
check_dir_exists(dirname($geoipfile));
$fp = fopen($geoipfile, 'w');
fwrite($fp, $contents);
fclose($fp);
$this->assertTrue(file_exists($geoipfile));
$CFG->geoipfile = $geoipfile;
$result = iplookup_find_location('147.230.16.1');
$this->assertEquals('array', gettype($result));
$this->assertEquals('Liberec', $result['city']);
$this->assertEquals(15.0653, $result['longitude'], '', 0.001);
$this->assertEquals(50.7639, $result['latitude'], '', 0.001);
$this->assertNull($result['error']);
$this->assertEquals('array', gettype($result['title']));
$this->assertEquals('Liberec', $result['title'][0]);
$this->assertEquals('Czech Republic', $result['title'][1]);
}
示例8: setUp
public function setUp()
{
global $CFG;
require_once "{$CFG->libdir}/filelib.php";
require_once "{$CFG->dirroot}/iplookup/lib.php";
if (!PHPUNIT_LONGTEST) {
// this may take a long time
$this->markTestSkipped('PHPUNIT_LONGTEST is not defined');
}
$this->resetAfterTest();
// let's store the file somewhere
$gzfile = "{$CFG->dataroot}/phpunit/geoip/GeoLite2-City.mmdb.gz";
check_dir_exists(dirname($gzfile));
if (file_exists($gzfile) and filemtime($gzfile) < time() - 60 * 60 * 24 * 30) {
// delete file if older than 1 month
unlink($gzfile);
}
if (!file_exists($gzfile)) {
download_file_content('http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz', null, null, false, 300, 20, false, $gzfile);
}
$this->assertTrue(file_exists($gzfile));
$geoipfile = str_replace('.gz', '', $gzfile);
// Open our files (in binary mode).
$file = gzopen($gzfile, 'rb');
$geoipfilebuf = fopen($geoipfile, 'wb');
// Keep repeating until the end of the input file.
while (!gzeof($file)) {
// Read buffer-size bytes.
// Both fwrite and gzread and binary-safe.
fwrite($geoipfilebuf, gzread($file, 4096));
}
// Files are done, close files.
fclose($geoipfilebuf);
gzclose($file);
$this->assertTrue(file_exists($geoipfile));
$CFG->geoip2file = $geoipfile;
}
示例9: scorm_parse_scorm
/**
* Sets up SCORM 1.2/2004 packages using the manifest file.
* Called whenever SCORM changes
* @param object $scorm instance - fields are updated and changes saved into database
* @param stored_file|string $manifest - path to manifest file or stored_file.
* @return bool
*/
function scorm_parse_scorm(&$scorm, $manifest)
{
global $CFG, $DB;
// load manifest into string
if ($manifest instanceof stored_file) {
$xmltext = $manifest->get_content();
} else {
require_once "{$CFG->libdir}/filelib.php";
$xmltext = download_file_content($manifest);
}
$defaultorgid = 0;
$firstinorg = 0;
$pattern = '/&(?!\\w{2,6};)/';
$replacement = '&';
$xmltext = preg_replace($pattern, $replacement, $xmltext);
$objXML = new xml2Array();
$manifests = $objXML->parse($xmltext);
$scoes = new stdClass();
$scoes->version = '';
$scoes = scorm_get_manifest($manifests, $scoes);
$newscoes = array();
$sortorder = 0;
if (count($scoes->elements) > 0) {
$olditems = $DB->get_records('scorm_scoes', array('scorm' => $scorm->id));
foreach ($scoes->elements as $manifest => $organizations) {
foreach ($organizations as $organization => $items) {
foreach ($items as $identifier => $item) {
$sortorder++;
// This new db mngt will support all SCORM future extensions
$newitem = new stdClass();
$newitem->scorm = $scorm->id;
$newitem->manifest = $manifest;
$newitem->organization = $organization;
$newitem->sortorder = $sortorder;
$standarddatas = array('parent', 'identifier', 'launch', 'scormtype', 'title');
foreach ($standarddatas as $standarddata) {
if (isset($item->{$standarddata})) {
$newitem->{$standarddata} = $item->{$standarddata};
} else {
$newitem->{$standarddata} = '';
}
}
if (!empty($defaultorgid) && !empty($scoes->defaultorg) && empty($firstinorg) && $newitem->parent == $scoes->defaultorg) {
$firstinorg = $sortorder;
}
if (!empty($olditems) && ($olditemid = scorm_array_search('identifier', $newitem->identifier, $olditems))) {
$newitem->id = $olditemid;
// Update the Sco sortorder but keep id so that user tracks are kept against the same ids.
$DB->update_record('scorm_scoes', $newitem);
$id = $olditemid;
// Remove all old data so we don't duplicate it.
$DB->delete_records('scorm_scoes_data', array('scoid' => $olditemid));
$DB->delete_records('scorm_seq_objective', array('scoid' => $olditemid));
$DB->delete_records('scorm_seq_mapinfo', array('scoid' => $olditemid));
$DB->delete_records('scorm_seq_ruleconds', array('scoid' => $olditemid));
$DB->delete_records('scorm_seq_rulecond', array('scoid' => $olditemid));
$DB->delete_records('scorm_seq_rolluprule', array('scoid' => $olditemid));
$DB->delete_records('scorm_seq_rolluprulecond', array('scoid' => $olditemid));
// Now remove this SCO from the olditems object as we have dealt with it.
unset($olditems[$olditemid]);
} else {
// Insert the new SCO, and retain the link between the old and new for later adjustment
$id = $DB->insert_record('scorm_scoes', $newitem);
}
$newscoes[$id] = $newitem;
// Save this sco in memory so we can use it later.
if ($optionaldatas = scorm_optionals_data($item, $standarddatas)) {
$data = new stdClass();
$data->scoid = $id;
foreach ($optionaldatas as $optionaldata) {
if (isset($item->{$optionaldata})) {
$data->name = $optionaldata;
$data->value = $item->{$optionaldata};
$dataid = $DB->insert_record('scorm_scoes_data', $data);
}
}
}
if (isset($item->sequencingrules)) {
foreach ($item->sequencingrules as $sequencingrule) {
$rule = new stdClass();
$rule->scoid = $id;
$rule->ruletype = $sequencingrule->type;
$rule->conditioncombination = $sequencingrule->conditioncombination;
$rule->action = $sequencingrule->action;
$ruleid = $DB->insert_record('scorm_seq_ruleconds', $rule);
if (isset($sequencingrule->ruleconditions)) {
foreach ($sequencingrule->ruleconditions as $rulecondition) {
$rulecond = new stdClass();
$rulecond->scoid = $id;
$rulecond->ruleconditionsid = $ruleid;
$rulecond->referencedobjective = $rulecondition->referencedobjective;
$rulecond->measurethreshold = $rulecondition->measurethreshold;
$rulecond->operator = $rulecondition->operator;
//.........这里部分代码省略.........
示例10: oembed_curlcall
/**
* Get the actual json from content provider
*
* @param string $www
* @return array
*/
protected function oembed_curlcall($www)
{
$ret = download_file_content($www, null, null, true, 300, 20, false, NULL, false);
$this->providerurl = $www;
$this->providerjson = $ret->results;
$result = json_decode($ret->results, true);
return $result;
}
示例11: scorm_check_package
function scorm_check_package($data)
{
global $CFG, $COURSE;
require_once $CFG->libdir . '/filelib.php';
$courseid = $data->course;
// Course Module ID
$reference = $data->reference;
// Package path
$scormid = $data->instance;
// scorm ID
$validation = new stdClass();
if (!empty($courseid) && !empty($reference)) {
$externalpackage = scorm_external_link($reference);
$validation->launch = 0;
$referencefield = $reference;
if (empty($reference)) {
$validation = null;
} else {
if ($reference[0] == '#') {
if (isset($CFG->repositoryactivate) && $CFG->repositoryactivate) {
$referencefield = $reference . '/imsmanifest.xml';
$reference = $CFG->repository . substr($reference, 1) . '/imsmanifest.xml';
} else {
$validation = null;
}
} else {
if (!$externalpackage) {
$reference = $CFG->dataroot . '/' . $courseid . '/' . $reference;
}
}
}
if (!empty($scormid)) {
//
// SCORM Update
//
if (!empty($validation) && (is_file($reference) || $externalpackage)) {
if (!$externalpackage) {
$mdcheck = md5_file($reference);
} else {
if ($externalpackage) {
if ($scormdir = make_upload_directory("{$courseid}/{$CFG->moddata}/scorm")) {
if ($tempdir = scorm_tempdir($scormdir)) {
$content = download_file_content($reference);
$file = fopen($tempdir . '/' . basename($reference), 'x');
fwrite($file, $content);
fclose($file);
$mdcheck = md5_file($tempdir . '/' . basename($reference));
scorm_delete_files($tempdir);
}
}
}
}
if ($scorm = get_record('scorm', 'id', $scormid)) {
if ($scorm->reference[0] == '#') {
if (isset($CFG->repositoryactivate) && $CFG->repositoryactivate) {
$oldreference = $CFG->repository . substr($scorm->reference, 1) . '/imsmanifest.xml';
} else {
$oldreference = $scorm->reference;
}
} else {
if (!scorm_external_link($scorm->reference)) {
$oldreference = $CFG->dataroot . '/' . $courseid . '/' . $scorm->reference;
} else {
$oldreference = $scorm->reference;
}
}
$validation->launch = $scorm->launch;
if ($oldreference == $reference && $mdcheck != $scorm->md5hash || $oldreference != $reference) {
// This is a new or a modified package
$validation->launch = 0;
} else {
// Old package already validated
if (strpos($scorm->version, 'AICC') !== false) {
$validation->pkgtype = 'AICC';
} else {
$validation->pkgtype = 'SCORM';
}
}
} else {
$validation = null;
}
} else {
$validation = null;
}
}
//$validation->launch = 0;
if ($validation != null && $validation->launch == 0) {
//
// Package must be validated
//
$ext = strtolower(substr(basename($reference), strrpos(basename($reference), '.')));
$tempdir = '';
switch ($ext) {
case '.pif':
case '.zip':
// Create a temporary directory to unzip package and validate package
$scormdir = '';
if ($scormdir = make_upload_directory("{$courseid}/{$CFG->moddata}/scorm")) {
if ($tempdir = scorm_tempdir($scormdir)) {
if ($externalpackage) {
//.........这里部分代码省略.........
示例12: print_error
$url->param('feedback', $feedback);
}
$PAGE->set_url($url);
if (!($course = $DB->get_record('course', array('id' => $id)))) {
print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $id);
require_capability('moodle/grade:import', $context);
require_capability('gradeimport/xml:view', $context);
// Large files are likely to take their time and memory. Let PHP know
// that we'll take longer, and that the process should be recycled soon
// to free up memory.
@set_time_limit(0);
raise_memory_limit(MEMORY_EXTRA);
$text = download_file_content($url);
if ($text === false) {
print_error('cannotreadfile');
}
$error = '';
$importcode = import_xml_grades($text, $course, $error);
if ($importcode !== false) {
/// commit the code if we are up this far
if (defined('USER_KEY_LOGIN')) {
if (grade_import_commit($id, $importcode, $feedback, false)) {
echo 'ok';
die;
} else {
print_error('cannotimportgrade');
//TODO: localize
}
示例13: create_file_from_url
/**
* Add new local file.
*
* @param stdClass|array $filerecord object or array describing file
* @param string $url the URL to the file
* @param array $options {@link download_file_content()} options
* @param bool $usetempfile use temporary file for download, may prevent out of memory problems
* @return stored_file
*/
public function create_file_from_url($filerecord, $url, array $options = null, $usetempfile = false)
{
$filerecord = (array) $filerecord;
// Do not modify the submitted record, this cast unlinks objects.
$filerecord = (object) $filerecord;
// We support arrays too.
$headers = isset($options['headers']) ? $options['headers'] : null;
$postdata = isset($options['postdata']) ? $options['postdata'] : null;
$fullresponse = isset($options['fullresponse']) ? $options['fullresponse'] : false;
$timeout = isset($options['timeout']) ? $options['timeout'] : 300;
$connecttimeout = isset($options['connecttimeout']) ? $options['connecttimeout'] : 20;
$skipcertverify = isset($options['skipcertverify']) ? $options['skipcertverify'] : false;
$calctimeout = isset($options['calctimeout']) ? $options['calctimeout'] : false;
if (!isset($filerecord->filename)) {
$parts = explode('/', $url);
$filename = array_pop($parts);
$filerecord->filename = clean_param($filename, PARAM_FILE);
}
$source = !empty($filerecord->source) ? $filerecord->source : $url;
$filerecord->source = clean_param($source, PARAM_URL);
if ($usetempfile) {
check_dir_exists($this->tempdir);
$tmpfile = tempnam($this->tempdir, 'newfromurl');
$content = download_file_content($url, $headers, $postdata, $fullresponse, $timeout, $connecttimeout, $skipcertverify, $tmpfile, $calctimeout);
if ($content === false) {
throw new file_exception('storedfileproblem', 'Can not fetch file form URL');
}
try {
$newfile = $this->create_file_from_pathname($filerecord, $tmpfile);
@unlink($tmpfile);
return $newfile;
} catch (Exception $e) {
@unlink($tmpfile);
throw $e;
}
} else {
$content = download_file_content($url, $headers, $postdata, $fullresponse, $timeout, $connecttimeout, $skipcertverify, NULL, $calctimeout);
if ($content === false) {
throw new file_exception('storedfileproblem', 'Can not fetch file form URL');
}
return $this->create_file_from_string($filerecord, $content);
}
}
示例14: array
$u->lang = 'en';
$u->description = 'Who\'s your daddy?';
$u->url = 'http://moodle.org';
$u->idnumber = '';
$u->institution = 'Moodle HQ';
$u->department = 'Rock on!';
$u->phone1 = '';
$u->phone2 = '';
$u->address = '';
// Adds an avatar to the user. Will slow down the process.
if (MDK_AVATAR) {
$params = array('size' => 160, 'force' => 'y', 'default' => 'wavatar');
$url = new moodle_url('http://www.gravatar.com/avatar/' . md5($u->id . ':' . $u->username), $params);
// Temporary file name
if (empty($CFG->tempdir)) {
$tempdir = $CFG->dataroot . "/temp";
} else {
$tempdir = $CFG->tempdir;
}
$picture = $tempdir . '/' . 'mdk_script_users.jpg';
download_file_content($url->out(false), null, null, false, 5, 2, false, $picture);
// Ensures retro compatibility
if (class_exists('context_user')) {
$context = context_user::instance($u->id);
} else {
$context = get_context_instance(CONTEXT_USER, $u->id, MUST_EXIST);
}
$u->picture = process_new_icon($context, 'user', 'icon', 0, $picture);
}
$DB->update_record('user', $u);
}
示例15: fetchExternalData
/**
* Implements fetchExternalData
*
* @param string $url Url starting with http(s)://
* @return bool|null|\stdClass|string Data object if successful fetch
*/
public function fetchExternalData($url, $data = null)
{
$response = download_file_content($url, null, $data);
return $response === false ? null : $response;
}