私は、cURL操作を含むいくつかのアプリケーションに取り組んでおり、特定のURLのコンテンツをスクレイピングしています。
そして、スクレイピングに続く計算/計算はほとんどありません。
私が今直面している問題は、UNDEFINED ARRAY INDEX に関連しています。
同様の問題に直面しているいくつかの関数を次に示します。
{注意: 未定義のオフセット: 263 行目の D:\xampp\htdocs\Alps-Phase2\alps\include\alpsOP\scrap-process-request2.php の 0}
これらに似た関数が他にもあります。
function getDomainName($objScrap)
 {
try
{
    $result = $objScrap->getDomainName();
    return $result;  //Notice: Undefined offset: 0 
}
catch( Exception $e)
{
    echo "Error in getDomainName !";
    return FALSE;
}
  }
  function getDataForDomainName($objScrap)
  {
try
{
    $result = $objScrap->checkForKeywordInDomain();
    return $result[0];    // Notice: Undefined offset: 0 
}
catch( Exception $e)
{
    echo "Error in getDataForDomainName !";
    return FALSE;
}
 }
function getDensityForDomainName($objScrap){
try
{
    $result = $objScrap->getDomainDensity();
    return $result[0];        // Notice: Undefined offset: 0 
}
catch( Exception $e)
{
    echo "Error in getDensityForDomainName !";
    return FALSE;
}
  }
一部の呼び出しの関数定義:
   function getDomainDensity()
  {
    $result=$this->getDomainName();
    return $this->getKeywordDensity($result);
  }
   function getDomainName()
  {
    preg_match($this->_regExpDomain,$this->_url,$match);
    if($match != NULL)
    return $match[2];
    else
    return array(
    0=> 'Please check URL '.$this->$_url.' [Domain Name]',
    'error' => 'Please check URL '.$this->$_url.' [Domain Name]'
                            );
  }
   function getKeywordDensity(&$subject)
    {
    $splitKeywordCountTotal_len=0;
    $splitKeywordCount = array();
    $resultArray = array();
      for($count_i=0;$count_i<count($this->_keywords);$count_i++)
        {
        $splitKeyword = $this->splitKeyword($this->_keywords[$count_i]);
        $splitKeywordCount=0;
        $splitKeywordCount = $this->prepareResultArray($subject,NULL,$splitKeyword);
        $matchedKeywordCharacterCount=0;
        $f=0;
        foreach ($splitKeywordCount as $val=>$key)
        {
            $splitKeywordCount[$f][2]=strlen($key[0]);
            $splitKeywordCount[$f][3]=$key[1]*strlen($key[0]);
            $matchedKeywordCharacterCount=$matchedKeywordCharacterCount+$splitKeywordCount[$f][3];
            $f++;
        }
        $totalWordsInVisibleContent = $this->getNumberOfWordsInSubject($subject);
        $f=0;
        $totalWordsInVisibleContent_len=0;
        foreach ($totalWordsInVisibleContent as $val=>$key)
        {
            $totalWordsInVisibleContent_len=$totalWordsInVisibleContent_len+strlen($key);
        }
        $splitKeywordCountTotal = 0;
        for($count_j=0;$count_j < count($splitKeywordCount);$count_j++)
        {
            $splitKeywordCountTotal = $splitKeywordCountTotal + $splitKeywordCount[$count_j][1];
            $splitKeywordCountTotal_len = $splitKeywordCountTotal_len + $splitKeywordCount[$count_j][2];
        }
        $resultArray[$count_i]      =   array();
        $resultArray[$count_i][0]   =   $this->_keywords[$count_i];
        $resultArray[$count_i][1]   =   $matchedKeywordCharacterCount/ ($totalWordsInVisibleContent_len);
        $resultArray[$count_i][2]   =   $splitKeywordCountTotal;
        $resultArray[$count_i][3]   =   $matchedKeywordCharacterCount;
        $resultArray[$count_i][4]   =   $totalWordsInVisibleContent;
        $resultArray[$count_i][5]   =   $splitKeywordCountTotal_len;
        $resultArray[$count_i][6]   =   $totalWordsInVisibleContent_len;
    }
    return $resultArray;
}
さらに、同じアプリケーションで 50 万の URL を実行する予定です。これらの通知が表示され続けると、アプリケーションのパフォーマンスが低下します。
みんな、問題を解決するのに助けが必要です。
* *コードの起草について申し訳ありません... フォーラムに新しく、構造体の使用方法を知りません.. :(