function shrinktheweb_fileGetContent in ShrinkTheWeb 8
Same name and namespace in other branches
- 6 shrinktheweb.api.inc \shrinktheweb_fileGetContent()
- 7 shrinktheweb.api.inc \shrinktheweb_fileGetContent()
Gets file content by URL.
Parameters
$sFileUrl:
array $aParams:
Return value
mixed|string
5 calls to shrinktheweb_fileGetContent()
- shrinktheweb_checkWebsiteThumbnailCaptured in ./
shrinktheweb.api.inc - Method that checks if the thumbnail for the specified website exists.
- shrinktheweb_downloadRemoteImageToLocalPath in ./
shrinktheweb.api.inc - Method to get image at the specified remote Url and attempt to save it to the specified local path.
- shrinktheweb_getAccountInfo in ./
shrinktheweb.api.inc - Get Account Info and return it as array.
- shrinktheweb_getNoResponseImage in ./
shrinktheweb.api.inc - Gets the account problem image and returns the relative path to the cached image.
- shrinktheweb_getThumbnail in ./
shrinktheweb.api.inc - Gets the thumbnail for the specified website, stores it in the cache, and then returns the relative path to the cached image.
File
- ./
shrinktheweb.api.inc, line 830
Code
function shrinktheweb_fileGetContent($sFileUrl, $aParams = array()) {
$sParams = '?';
foreach ($aParams as $sKey => $sValue) {
$sParams .= $sKey . '=' . $sValue . '&';
}
$sParams = substr($sParams, 0, -1);
$sResult = '';
if (function_exists('curl_init')) {
$rConnect = curl_init();
curl_setopt($rConnect, CURLOPT_URL, $sFileUrl . $sParams);
curl_setopt($rConnect, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($rConnect, CURLOPT_FOLLOWLOCATION, 0);
// Must be 0 or else headers will break SimpleXML parsing.
curl_setopt($rConnect, CURLOPT_HEADER, 0);
$sResult = curl_exec($rConnect);
curl_close($rConnect);
}
else {
$sResult = @file_get_contents($sFileUrl . $sParams);
}
return $sResult;
}