X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/airbundle/blobdiff_plain/1cb9165e95db75354b5681b7749fcdf9133afd5a..HEAD:/Command/WeatherCommand.php diff --git a/Command/WeatherCommand.php b/Command/WeatherCommand.php index 00f922c..a7572b0 100644 --- a/Command/WeatherCommand.php +++ b/Command/WeatherCommand.php @@ -1,12 +1,24 @@ - + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Rapsys\AirBundle\Command; use Doctrine\Bundle\DoctrineBundle\Command\DoctrineCommand; +use Doctrine\Persistence\ManagerRegistry; + use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Filesystem\Exception\IOExceptionInterface; +use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; + use Rapsys\AirBundle\Entity\Session; class WeatherCommand extends DoctrineCommand { @@ -33,28 +45,55 @@ class WeatherCommand extends DoctrineCommand { //Hourly uri 'hourly' => [ 75001 => 'https://www.accuweather.com/en/fr/paris-01-louvre/75001/hourly-weather-forecast/179142_pc?day=', + 75004 => 'https://www.accuweather.com/en/fr/paris-04-hotel-de-ville/75004/hourly-weather-forecast/179145_pc?day=', 75005 => 'https://www.accuweather.com/en/fr/paris-05-pantheon/75005/hourly-weather-forecast/179146_pc?day=', + 75006 => 'https://www.accuweather.com/fr/fr/paris-06-luxembourg/75006/hourly-weather-forecast/179147_pc?day=', 75007 => 'https://www.accuweather.com/en/fr/paris-07-palais-bourbon/75007/hourly-weather-forecast/179148_pc?day=', 75009 => 'https://www.accuweather.com/en/fr/paris-09-opera/75009/hourly-weather-forecast/179150_pc?day=', + 75010 => 'https://www.accuweather.com/en/fr/paris-10-entrepot/75010/hourly-weather-forecast/179151_pc?day=', + 75012 => 'https://www.accuweather.com/en/fr/paris-12-reuilly/75012/hourly-weather-forecast/179153_pc?day=', + 75013 => 'https://www.accuweather.com/en/fr/paris-13-gobelins/75013/hourly-weather-forecast/179154_pc?day=', 75015 => 'https://www.accuweather.com/en/fr/paris-15-vaugirard/75015/hourly-weather-forecast/179156_pc?day=', 75019 => 'https://www.accuweather.com/en/fr/paris-19-buttes-chaumont/75019/hourly-weather-forecast/179160_pc?day=', 75116 => 'https://www.accuweather.com/en/fr/paris-16-passy/75116/hourly-weather-forecast/179246_pc?day=' ], //Daily uri 'daily' => [ - 75001 => 'https://www.accuweather.com/en/fr/paris-01-louvre/75001/daily-weather-forecast/179142_pc', - 75005 => 'https://www.accuweather.com/en/fr/paris-05-pantheon/75005/daily-weather-forecast/179146_pc', - 75007 => 'https://www.accuweather.com/en/fr/paris-07-palais-bourbon/75007/daily-weather-forecast/179148_pc', - 75009 => 'https://www.accuweather.com/en/fr/paris-09-opera/75009/daily-weather-forecast/179150_pc', - 75015 => 'https://www.accuweather.com/en/fr/paris-15-vaugirard/75015/daily-weather-forecast/179156_pc', - 75019 => 'https://www.accuweather.com/en/fr/paris-19-buttes-chaumont/75019/daily-weather-forecast/179160_pc', - 75116 => 'https://www.accuweather.com/en/fr/paris-16-passy/75116/daily-weather-forecast/179246_pc' + 75001 => 'https://www.accuweather.com/en/fr/paris-01-louvre/75001/10-day-weather-forecast/179142_pc?page=%7Bpage%7D', + 75004 => 'https://www.accuweather.com/en/fr/paris-04-hotel-de-ville/75004/10-day-weather-forecast/179145_pc?page=%7Bpage%7D', + 75005 => 'https://www.accuweather.com/en/fr/paris-05-pantheon/75005/10-day-weather-forecast/179146_pc?page=%7Bpage%7D', + 75006 => 'https://www.accuweather.com/fr/fr/paris-06-luxembourg/75006/10-day-weather-forecast/179147_pc?page=%7Bpage%7D', + 75007 => 'https://www.accuweather.com/en/fr/paris-07-palais-bourbon/75007/10-day-weather-forecast/179148_pc?page=%7Bpage%7D', + 75009 => 'https://www.accuweather.com/en/fr/paris-09-opera/75009/10-day-weather-forecast/179150_pc?page=%7Bpage%7D', + 75010 => 'https://www.accuweather.com/en/fr/paris-10-entrepot/75010/10-day-weather-forecast/179151_pc?page=%7Bpage%7D', + 75012 => 'https://www.accuweather.com/en/fr/paris-12-reuilly/75012/10-day-weather-forecast/179153_pc?page=%7Bpage%7D', + 75013 => 'https://www.accuweather.com/en/fr/paris-13-gobelins/75013/10-day-weather-forecast/179154_pc?page=%7Bpage%7D', + 75015 => 'https://www.accuweather.com/en/fr/paris-15-vaugirard/75015/10-day-weather-forecast/179156_pc?page=%7Bpage%7D', + 75019 => 'https://www.accuweather.com/en/fr/paris-19-buttes-chaumont/75019/10-day-weather-forecast/179160_pc?page=%7Bpage%7D', + 75116 => 'https://www.accuweather.com/en/fr/paris-16-passy/75116/10-day-weather-forecast/179246_pc?page=%7Bpage%7D' ] ]; ///Set curl handler private $ch = null; + ///Set manager registry + private $doctrine; + + ///Set filesystem + private $filesystem; + + ///Weather command constructor + public function __construct(ManagerRegistry $doctrine, Filesystem $filesystem) { + parent::__construct($doctrine); + + //Set entity manager + $this->doctrine = $doctrine; + + //Set filesystem + $this->filesystem = $filesystem; + } + ///Configure attribute command protected function configure() { //Configure the class @@ -70,12 +109,30 @@ class WeatherCommand extends DoctrineCommand { } ///Process the attribution - protected function execute(InputInterface $input, OutputInterface $output) { - //Fetch doctrine - $doctrine = $this->getDoctrine(); + protected function execute(InputInterface $input, OutputInterface $output): int { + //Kernel object + $kernel = $this->getApplication()->getKernel(); + + //Tmp directory + $tmpdir = $kernel->getContainer()->getParameter('kernel.project_dir').'/var/cache/weather'; + + //Set tmpdir + //XXX: worst case scenario we have 3 files per zipcode plus daily + if (!is_dir($tmpdir)) { + try { + //Create dir + $this->filesystem->mkdir($tmpdir, 0775); + } catch (IOException $exception) { + //Display error + echo 'Create dir '.$exception->getPath().' failed'."\n"; + + //Exit with failure + exit(self::FAILURE); + } + } - //Get manager - $manager = $doctrine->getManager(); + //Cleanup kernel + unset($kernel); //Tidy object $tidy = new \tidy(); @@ -89,7 +146,7 @@ class WeatherCommand extends DoctrineCommand { //Process hourly accuweather if (($command = $input->getFirstArgument()) == 'rapsysair:weather:hourly' || $command == 'rapsysair:weather') { //Fetch hourly sessions to attribute - $types['hourly'] = $doctrine->getRepository(Session::class)->findAllPendingHourlyWeather(); + $types['hourly'] = $this->doctrine->getRepository(Session::class)->findAllPendingHourlyWeather(); //Iterate on each session foreach($types['hourly'] as $sessionId => $session) { @@ -120,6 +177,12 @@ class WeatherCommand extends DoctrineCommand { //Set stop day $day = $stop->diff((new \DateTime('now'))->setTime(0, 0, 0))->d + 1; + //Skip 4th day + //XXX: accuweather only allow until 3rd day + if ($day >= 4) { + continue; + } + //Check if zipcode date is set if (!isset($zipcodes[$zipcode][$day])) { $zipcodes[$zipcode][$day] = [ $sessionId => $sessionId ]; @@ -132,7 +195,7 @@ class WeatherCommand extends DoctrineCommand { //Process daily accuweather if ($command == 'rapsysair:weather:daily' || $command == 'rapsysair:weather') { //Fetch daily sessions to attribute - $types['daily'] = $doctrine->getRepository(Session::class)->findAllPendingDailyWeather(); + $types['daily'] = $this->doctrine->getRepository(Session::class)->findAllPendingDailyWeather(); //Iterate on each session foreach($types['daily'] as $sessionId => $session) { @@ -159,26 +222,8 @@ class WeatherCommand extends DoctrineCommand { } } - //Get filesystem - $filesystem = new Filesystem(); - - //Set tmpdir - //XXX: worst case scenario we have 3 files per zipcode - if (!is_dir($tmpdir = sys_get_temp_dir().'/accuweather')) { - try { - //Create dir - $filesystem->mkdir($tmpdir, 0775); - } catch (IOExceptionInterface $exception) { - //Display error - echo 'Create dir '.$exception->getPath().' failed'."\n"; - - //Exit with failure - exit(self::FAILURE); - } - } - //Init curl - $this->curl_init(); + $this->curl_init($tmpdir); //Init data array $data = []; @@ -219,20 +264,20 @@ class WeatherCommand extends DoctrineCommand { //Load simplexml //XXX: trash all xmlns= broken tags - $sx = new \SimpleXMLElement(str_replace(['xmlns=', 'xlink:href='], ['xns=', 'href='], $tidy)); + $sx = new \SimpleXMLElement(str_replace(['xmlns=', 'xlink:href='], ['xns=', 'href='], (string)$tidy)); //Process daily if ($day == 'daily') { //Iterate on each link containing data - foreach($sx->xpath('//a[@class="daily-forecast-card"]') as $node) { + foreach($sx->xpath('//a[contains(@class,"daily-forecast-card")]') as $node) { //Get date - $dsm = trim($node->div[0]->h2[0]->span[1]); + $dsm = trim((string)$node->div[0]->h2[0]->span[1]); //Get temperature - $temperature = str_replace('°', '', $node->div[0]->div[0]->span[0]); + $temperature = str_replace('°', '', (string)$node->div[0]->div[0]->span[0]); //Get rainrisk - $rainrisk = str_replace('%', '', trim($node->div[2]))/100; + $rainrisk = trim(str_replace('%', '', (string)$node->div[1]))/100; //Store data $data[$zipcode][$dsm]['daily'] = [ @@ -247,28 +292,31 @@ class WeatherCommand extends DoctrineCommand { #/html/body/div[1]/div[5]/div[1]/div[1]/div[1]/div[1]/div[1]/div/h2/span[1] foreach($sx->xpath('//div[@data-shared="false"]') as $node) { //Get hour - $hour = trim($node->div[0]->div[0]->h2[0]->span[0]); + $hour = trim(str_replace(' h', '', (string)$node->div[0]->div[0]->div[0]->div[0]->div[0]->h2[0])); - //Get dsm - $dsm = trim($node->div[0]->div[0]->h2[0]->span[1]); + //Compute dsm from day (1=d,2=d+1,3=d+2) + $dsm = (new \DateTime('+'.($day - 1).' day'))->format('d/m'); //Get temperature - $temperature = str_replace('°', '', $node->div[0]->div[0]->div[0]); + $temperature = str_replace('°', '', (string)$node->div[0]->div[0]->div[0]->div[0]->div[1]); //Get realfeel - $realfeel = str_replace(['RealFeel® ', '°'], '', trim($node->div[0]->div[0]->span[0])); + $realfeel = trim(str_replace(['RealFeel®', '°'], '', (string)$node->div[0]->div[0]->div[0]->div[1]->div[0]->div[0]->div[0])); //Get rainrisk - $rainrisk = str_replace('%', '', trim($node->div[0]->div[0]->div[1]))/100; - - //Label is Rain when we have a rainfall - if (($pluviolabel = trim($node->div[1]->div[0]->div[0]->div[1]->p[1])) == 'Rain') { - //Get rainfall - $rainfall = str_replace(' mm', '', $node->div[1]->div[0]->div[0]->div[1]->p[1]->span[0]); - //Cloud Cover, no rainfall - } else { - //Set rainfall to 0 (mm) - $rainfall = 0; + $rainrisk = floatval(str_replace('%', '', trim((string)$node->div[0]->div[0]->div[0]->div[2]->div[0]))/100); + + //Set rainfall to 0 (mm) + $rainfall = 0; + + //Iterate on each entry + //TODO: wind and other infos are present in $node->div[1]->div[0]->div[1]->div[0]->p + foreach($node->div[1]->div[0]->div[1]->div[0]->p as $p) { + //Lookup for rain entry if present + if (in_array(trim((string)$p), ['Rain', 'Pluie'])) { + //Get rainfall + $rainfall = floatval(str_replace(' mm', '', (string)$p->span[0])); + } } //Store data @@ -337,11 +385,11 @@ class WeatherCommand extends DoctrineCommand { $hour = $type=='daily'?$type:$time->format('H'); //Check data availability - //XXX: should never happen - #if (!isset($data[$zipcode][$dsm][$hour])) { - # //Skip unavailable data - # continue; - #} + //XXX: sometimes startup delay causes weather data to be unavailable for session first hour + if (!isset($data[$zipcode][$dsm][$hour])) { + //Skip unavailable data + continue; + } //Set info alias $info = $data[$zipcode][$dsm][$hour]; @@ -411,7 +459,6 @@ class WeatherCommand extends DoctrineCommand { //Check if realfeel differ if ($session->getRealfeel() !== $realfeel) { //Set average realfeel - #$meteo['realfeel'] = array_sum($meteo['realfeel'])/count($meteo['realfeel']); $session->setRealfeel($realfeel); } @@ -436,7 +483,6 @@ class WeatherCommand extends DoctrineCommand { //Check if temperature differ if ($session->getTemperature() !== $temperature) { //Set average temperature - #$meteo['temperature'] = array_sum($meteo['temperature'])/count($meteo['temperature']); $session->setTemperature($temperature); } @@ -456,7 +502,7 @@ class WeatherCommand extends DoctrineCommand { } //Flush to get the ids - $manager->flush(); + $this->doctrine->getManager()->flush(); //Close curl handler $this->curl_close(); @@ -470,7 +516,7 @@ class WeatherCommand extends DoctrineCommand { * * @return bool|void Return success or exit */ - function curl_init() { + function curl_init(string $tmpdir) { //Init curl if (($this->ch = curl_init()) === false) { //Display error @@ -486,6 +532,8 @@ class WeatherCommand extends DoctrineCommand { [ //Force http2 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2_0, + //Accept encoding + CURLOPT_ACCEPT_ENCODING => '', //Set http headers CURLOPT_HTTPHEADER => [ //XXX: it seems that you can disable akamai fucking protection with Pragma: akamai-x-cache-off @@ -494,25 +542,82 @@ class WeatherCommand extends DoctrineCommand { //XXX: working curl command #curl --http2 --cookie file.jar --cookie-jar file.jar -v -i -k -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' -H 'Accept-Language: en-GB,en;q=0.9' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' -H 'Host: www.accuweather.com' -H 'Pragma: no-cache' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' 'https://www.accuweather.com/' //Set accept - 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', + 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', + //Set encoding + 'Accept-Encoding: gzip, deflate, br, zstd', //Set accept language 'Accept-Language: en-GB,en;q=0.9', //Disable cache 'Cache-Control: no-cache', //Keep connection alive - 'Connection: keep-alive', + #XXX: to drop? 'Connection: keep-alive', + //Do not track + 'Dnt: 1', //Disable cache 'Pragma: no-cache', + //Priority + 'Priority: u=0, i', + //Sec ch ua + 'Sec-CH-UA: "Chromium";v="148", "Google Chrome";v="148", "Not/A)Brand";v="99"', + //Sec ch ua mobile + 'Sec-CH-Mobile: ?0', + //Sec ch ua platform + 'Sec-CH-UA-Platform: "Windows"', + //Sec fetch dest + 'Sec-Fetch-Dest: document', + //Sec fetch mode + 'Sec-Fetch-Mode: navigate', + //Sec fetch site + 'Sec-Fetch-Site: none', + //Sec fetch user + 'Sec-Fetch-User: ?1', //Force secure requests 'Upgrade-Insecure-Requests: 1', //Set user agent - 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', //Force akamai cookie //XXX: seems to come from http request - 'Cookie: AKA_A2=A', + #'Cookie: AKA_A2=A', + //TODO: add akamai cookie ? + //XXX: see https://www.ford.eu/cookie-guide + #ak_bmsc: ajouter ? valable un jour ? +#request-context: appId=cid-v1:69db91ae-4014-4da6-962b-6e1205fccce5 +#< permissions-policy: browsing-topics=() +#permissions-policy: browsing-topics=() +#< vary: Accept-Encoding +#vary: Accept-Encoding +#< content-encoding: gzip +#content-encoding: gzip +#< date: Mon, 23 Mar 2026 22:36:43 GMT +#date: Mon, 23 Mar 2026 22:36:43 GMT +#< content-length: 39349 +#content-length: 39349 +#* Added cookie awx_id="1062821a-a1f2-42be-82ec-859a2aac16ef" for domain www.accuweather.com, path /, expire 1805841403 +#< set-cookie: awx_id=1062821a-a1f2-42be-82ec-859a2aac16ef; expires=Tue, 23 Mar 2027 22:36:43 GMT; path=/; secure; httponly +#set-cookie: awx_id=1062821a-a1f2-42be-82ec-859a2aac16ef; expires=Tue, 23 Mar 2027 22:36:43 GMT; path=/; secure; httponly +#* Added cookie awx_session_essential="id%3A614c5979-6977-444e-a900-c0834e6602fb%7CpageView%3A1" for domain www.accuweather.com, path /, expire 1774306003 +#< set-cookie: awx_session_essential=id%3A614c5979-6977-444e-a900-c0834e6602fb%7CpageView%3A1; expires=Mon, 23 Mar 2026 22:46:43 GMT; path=/; secure; samesite=lax; httponly +#set-cookie: awx_session_essential=id%3A614c5979-6977-444e-a900-c0834e6602fb%7CpageView%3A1; expires=Mon, 23 Mar 2026 22:46:43 GMT; path=/; secure; samesite=lax; httponly + +#* Replaced cookie awx_id="1062821a-a1f2-42be-82ec-859a2aac16ef" for domain www.accuweather.com, path /, expire 1805841454 +#< set-cookie: awx_id=1062821a-a1f2-42be-82ec-859a2aac16ef; expires=Tue, 23 Mar 2027 22:37:34 GMT; path=/; secure; httponly +#set-cookie: awx_id=1062821a-a1f2-42be-82ec-859a2aac16ef; expires=Tue, 23 Mar 2027 22:37:34 GMT; path=/; secure; httponly +#* Replaced cookie awx_session_essential="id%3A614c5979-6977-444e-a900-c0834e6602fb%7CpageView%3A2" for domain www.accuweather.com, path /, expire 1774306054 +#< set-cookie: awx_session_essential=id%3A614c5979-6977-444e-a900-c0834e6602fb%7CpageView%3A2; expires=Mon, 23 Mar 2026 22:47:34 GMT; path=/; secure; samesite=lax; httponly +#set-cookie: awx_session_essential=id%3A614c5979-6977-444e-a900-c0834e6602fb%7CpageView%3A2; expires=Mon, 23 Mar 2026 22:47:34 GMT; path=/; secure; samesite=lax; httponly +#< strict-transport-security: max-age=15768000 ; includeSubDomains ; preload +#strict-transport-security: max-age=15768000 ; includeSubDomains ; preload +#* Added cookie ak_bmsc="010A87851EDC882D1FE84B535E75D0C6~000000000000000000000000000000~YAAQfOIlF3lI//WcAQAAZqrYHB/DJCb/+t9xHWxhT1EDW/Qe8778baYOLuqlhfzRUU1m6YXWfZjRJlfkpMYg5WdzrV2Y0WtHuiTknE9/AMA9MTh82uI4z4xr3Rv3TeZjG+ggc05Sp2rKiyYjHxgq7ZN9fHAFS0Mqab+DTtTtAZaSCeBc96tb+hg0c3TEXZSDRStGppvA1ejPTO1Q3jZ+PIXZ0NzR3LN4DcpmvgtcB1A4vIsIuXhqbsvz6ns2XdKIYgvrdY6v0mJA6+EbAv+O/u0WRlcM1akq5+Cahmm8lgpy52DRuq82lwLR0JwtUHc+JjukuY9bWSi595VZvehTyhnjXHqSY7M1qhpJ9IVR9wFRWWFo5SSOZpEW5xsl+n2Aph4XHkuEKxc2TnqXHA4fdgM=" for domain accuweather.com, path /, expire 1774312654 +#< set-cookie: ak_bmsc=010A87851EDC882D1FE84B535E75D0C6~000000000000000000000000000000~YAAQfOIlF3lI//WcAQAAZqrYHB/DJCb/+t9xHWxhT1EDW/Qe8778baYOLuqlhfzRUU1m6YXWfZjRJlfkpMYg5WdzrV2Y0WtHuiTknE9/AMA9MTh82uI4z4xr3Rv3TeZjG+ggc05Sp2rKiyYjHxgq7ZN9fHAFS0Mqab+DTtTtAZaSCeBc96tb+hg0c3TEXZSDRStGppvA1ejPTO1Q3jZ+PIXZ0NzR3LN4DcpmvgtcB1A4vIsIuXhqbsvz6ns2XdKIYgvrdY6v0mJA6+EbAv+O/u0WRlcM1akq5+Cahmm8lgpy52DRuq82lwLR0JwtUHc+JjukuY9bWSi595VZvehTyhnjXHqSY7M1qhpJ9IVR9wFRWWFo5SSOZpEW5xsl+n2Aph4XHkuEKxc2TnqXHA4fdgM=; Domain=.accuweather.com; Path=/; Expires=Tue, 24 Mar 2026 00:37:34 GMT; Max-Age=7200; HttpOnly +#set-cookie: ak_bmsc=010A87851EDC882D1FE84B535E75D0C6~000000000000000000000000000000~YAAQfOIlF3lI//WcAQAAZqrYHB/DJCb/+t9xHWxhT1EDW/Qe8778baYOLuqlhfzRUU1m6YXWfZjRJlfkpMYg5WdzrV2Y0WtHuiTknE9/AMA9MTh82uI4z4xr3Rv3TeZjG+ggc05Sp2rKiyYjHxgq7ZN9fHAFS0Mqab+DTtTtAZaSCeBc96tb+hg0c3TEXZSDRStGppvA1ejPTO1Q3jZ+PIXZ0NzR3LN4DcpmvgtcB1A4vIsIuXhqbsvz6ns2XdKIYgvrdY6v0mJA6+EbAv+O/u0WRlcM1akq5+Cahmm8lgpy52DRuq82lwLR0JwtUHc+JjukuY9bWSi595VZvehTyhnjXHqSY7M1qhpJ9IVR9wFRWWFo5SSOZpEW5xsl+n2Aph4XHkuEKxc2TnqXHA4fdgM=; Domain=.accuweather.com; Path=/; Expires=Tue, 24 Mar 2026 00:37:34 GMT; Max-Age=7200; HttpOnly +#* Added cookie bm_mi="F052B40D9957D87932CF91B3BCD53103~YAAQfOIlF3pI//WcAQAAZqrYHB8MhsqiidkryWWG/FELf+Jop+KjoERXKsZW/oxZ+c6ldIx5C8iwD7ReaDYhYufdjAYrxGXN6LkLRd17iwN/5USm1sOBD3V1XD9K4ftXO6eBsjIxI9lfZvY8KN/HCAMLPn68AbLWCDNyNuku9oOc4cr4CqrTVdoz73o4crl1BVwm2bIxeXGnG5FhznRy3+99KgY6IjinBcHKaUIATLOgrvjwkTKB19/m4DWOpp805vVbaa6EdhuTAM2KjaNK6DUx9WR+GVWBQ63X0SJ+4lAT2qVWCWrfVWmDijgunHoTmQvbJHliBpapOvUe3ShoZOMromAbzvfuSO//PIwGNPEgvq8FDD19nNyZCAArgTkg11pXAgH8jaZRon811vKVu3+nyNM=~1" for domain accuweather.com, path /, expire 1 +#< set-cookie: bm_mi=F052B40D9957D87932CF91B3BCD53103~YAAQfOIlF3pI//WcAQAAZqrYHB8MhsqiidkryWWG/FELf+Jop+KjoERXKsZW/oxZ+c6ldIx5C8iwD7ReaDYhYufdjAYrxGXN6LkLRd17iwN/5USm1sOBD3V1XD9K4ftXO6eBsjIxI9lfZvY8KN/HCAMLPn68AbLWCDNyNuku9oOc4cr4CqrTVdoz73o4crl1BVwm2bIxeXGnG5FhznRy3+99KgY6IjinBcHKaUIATLOgrvjwkTKB19/m4DWOpp805vVbaa6EdhuTAM2KjaNK6DUx9WR+GVWBQ63X0SJ+4lAT2qVWCWrfVWmDijgunHoTmQvbJHliBpapOvUe3ShoZOMromAbzvfuSO//PIwGNPEgvq8FDD19nNyZCAArgTkg11pXAgH8jaZRon811vKVu3+nyNM=~1; Domain=.accuweather.com; Path=/; Expires=Mon, 23 Mar 2026 22:37:34 GMT; Max-Age=0; Secure +#set-cookie: bm_mi=F052B40D9957D87932CF91B3BCD53103~YAAQfOIlF3pI//WcAQAAZqrYHB8MhsqiidkryWWG/FELf+Jop+KjoERXKsZW/oxZ+c6ldIx5C8iwD7ReaDYhYufdjAYrxGXN6LkLRd17iwN/5USm1sOBD3V1XD9K4ftXO6eBsjIxI9lfZvY8KN/HCAMLPn68AbLWCDNyNuku9oOc4cr4CqrTVdoz73o4crl1BVwm2bIxeXGnG5FhznRy3+99KgY6IjinBcHKaUIATLOgrvjwkTKB19/m4DWOpp805vVbaa6EdhuTAM2KjaNK6DUx9WR+GVWBQ63X0SJ+4lAT2qVWCWrfVWmDijgunHoTmQvbJHliBpapOvUe3ShoZOMromAbzvfuSO//PIwGNPEgvq8FDD19nNyZCAArgTkg11pXAgH8jaZRon811vKVu3+nyNM=~1; Domain=.accuweather.com; Path=/; Expires=Mon, 23 Mar 2026 22:37:34 GMT; Max-Age=0; Secure +# +#< ], //Enable cookie - CURLOPT_COOKIEFILE => '', + CURLOPT_COOKIEFILE => $tmpdir.'/cookies.txt', //Disable location following CURLOPT_FOLLOWLOCATION => false, //Set url