public function start()
 {
     $content = parent::start();
     // check if the we actually downloaded anything
     if (strlen($content) == 0) {
         throw new Exception('Empty profile data');
     }
     // trim extra profile data (groups, friends, most played games)
     if ($this->bTrimExtra) {
         $sEndToken = '</summary>';
         $iEndPos = strpos($content, $sEndToken);
         if ($iEndPos !== false) {
             $content = substr($content, 0, $iEndPos + strlen($sEndToken));
             $content .= "\n</profile>";
         }
     }
     // remove certain control characters that are misleadingly send by the API,
     // which are invalid in XML 1.0
     if ($this->bFilterCtlChars) {
         $aCtlChr = array();
         for ($i = 0; $i < 32; $i++) {
             // tab, lf and cr are allowed
             if ($i == 9 || $i == 10 || $i == 13) {
                 continue;
             }
             $aCtlChr[] = chr($i);
         }
         $content = str_replace($aCtlChr, '', $content);
     }
     return $content;
 }
Example #2
0
 public function load(HttpLoader $loader, DataRender $render)
 {
     $pages_url = $this->webPagesURI;
     $result = $loader->load($pages_url);
     //print_r($result);
     if (false !== $result) {
         return $render->render($result);
     } else {
         echo 'failed curl request';
     }
 }
 private function loadJpegUrl($sUrl)
 {
     $cacheFile = $this->oJpgAssetCache->getFile($sUrl);
     // do we already have a cached version of this image?
     if (!$cacheFile->isCached()) {
         $iTimeout = $this->oCommonConfig->getInteger('downloader.timeout', 10);
         $imageLoader = new HttpLoader($sUrl, SteamProfileApp::AGENT, 'Image');
         $imageLoader->setTimeout($iTimeout);
         $imageLoader->setOutputFile($cacheFile->getPath());
         $imageLoader->start();
         $imageLoader->close();
     }
     return $cacheFile;
 }