fix parsing ugc.fr (new website)

This commit is contained in:
2017-08-12 17:16:06 +12:00
parent bbb7986123
commit d65cc41078
7 changed files with 76 additions and 57 deletions

View File

@@ -3,6 +3,7 @@
require_once 'settings.php';
define('TMP_FOLDER', 'tmp/');
define('UGC_URL', 'https://ugc.fr');
function getPage($sPath, $asVars, $sType)
{
@@ -15,12 +16,14 @@ function getPage($sPath, $asVars, $sType)
}
if(!$bSavePage || !file_exists($sFileName) || date('dmY', filemtime($sFileName))!=date('dmY'))
{
$sUrl = 'http://www.ugc.fr/'.$sPath.'?'.http_build_query($asVars);
$sUrl = UGC_URL.'/'.$sPath.'?'.http_build_query($asVars);
$oCurl = curl_init();
curl_setopt($oCurl, CURLOPT_URL, $sUrl);
curl_setopt($oCurl, CURLOPT_HEADER, false);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($oCurl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($oCurl, CURLOPT_REFERER, UGC_URL.'/homepage.html');
$sContent = curl_exec($oCurl);
curl_close($oCurl);