function shrinktheweb_fileGetContent in ShrinkTheWeb 7
Same name and namespace in other branches
- 8 shrinktheweb.api.inc \shrinktheweb_fileGetContent()
- 6 shrinktheweb.api.inc \shrinktheweb_fileGetContent()
Gets file content by URL
4 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 specifed 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
File
- ./
shrinktheweb.api.inc, line 607
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);
curl_setopt($rConnect, CURLOPT_HEADER, 0);
// must be 0 or else headers will break SimpleXML parsing
$sResult = curl_exec($rConnect);
curl_close($rConnect);
}
else {
$sResult = @file_get_contents($sFileUrl . $sParams);
}
return $sResult;
}