Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6602709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:54:31+00:00 2026-05-25T18:54:31+00:00

I cant find that what i have missed in this function so its generating

  • 0

I cant find that what i have missed in this function so its generating this ERROR some time not always ?

ERROR :-

Notice: Undefined offset: 13 in /home/chandrak/public_html/tmp/c/Crawler.php on line 131

Line number 131 is defined in the below code.

        function crawlImage($url)
        {
            $content=$this->getContent($url);
            $domain=$this->getDomain($url);

            //echo $domain,'<br>';
            $dom = new DOMDocument();
            @$dom->loadHTML($content);      
            $xdoc = new DOMXPath($dom); 
            //Read the images that is between <a> tag
            $atags = $xdoc ->evaluate("//a");       //Read all a tags   
            $index=0;

            for ($i = 0; $i < $atags->length; $i++) 
            {
                $atag = $atags->item($i);           //select an a tag
                $imagetags=$atag->getElementsByTagName("img");//get img tag
                $imagetag=$imagetags->item(0);
                if(sizeof($imagetag)>0)//if img tag exists
                {
                    $imagelinked['src'][$index]=$imagetag->getAttribute('src');//save image src
                    $imagelinked['link'][$index]=$atag->getAttribute('href');//save image link      
                    $index=$index+1;
                }
            }           
            //Read all image
            //Betweem <img> tag 
            $imagetags = $xdoc ->evaluate("//img"); //Read all img tags 
            $index=0;
            $indexlinked=0;
            for ($i = 0; $i < $imagetags->length; $i++) 
            {
                $imagetag = $imagetags->item($i);                                   
                $imagesrc=$imagetag->getAttribute('src');           
                $image['link'][$index]=null;

    /*LINE NO 131 */    if($imagesrc==$imagelinked['src'][$indexlinked])  //THIS IS LINE NUBER 131          
                           {
                    $image['link'][$index]=$this->convertLink($domain,$url,$imagelinked['link'][$indexlinked]);
                    $indexlinked=$indexlinked+1;
                }
                $image['src'][$index]=$this->convertLink($domain,$url,$imagesrc);
                $index=$index+1;            
            }       
            return $image;  
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:54:32+00:00Added an answer on May 25, 2026 at 6:54 pm

    Change the line to:

    if (isset($imagelinked['src'][$indexlinked]) && $imagesrc == $imagelinked['src'][$indexlinked]) {
    

    …and the error should disappear.

    EDIT here is an edited version of the function with that error avoided, and a couple of pointless variables removed, and a couple of lines concatenated, and a missing { added.

    function crawlImage ($url) {
      $domain = $this->getDomain($url);
      //echo $domain,'<br>';
      $dom = new DOMDocument();
      @$dom->loadHTML($this->getContent($url));  
      $xdoc = new DOMXPath($dom); 
      // Read the images that is between <a> tag
      $atags = $xdoc->evaluate("//a");  // Read all <a> tags 
      for ($index = 0, $i = 0; $i < $atags->length; $i++) {
        $atag = $atags->item($i);   // Select an <a> tag
        $imagetags = $atag->getElementsByTagName("img");//get img tag
        $imagetag = $imagetags->item(0);
        if (sizeof($imagetag) > 0) { // If <img> tag exists
          $imagelinked['src'][$index] = $imagetag->getAttribute('src'); // Save image src
          $imagelinked['link'][$index] = $atag->getAttribute('href'); // Save image link  
          $index++;
        }
      }   
      // Read all images between <img> tag 
      $imagetags = $xdoc->evaluate("//img"); //Read all img tags 
      for ($indexlinked = 0, $i = 0; $i < $imagetags->length; $i++) {
        $imagetag = $imagetags->item($i);         
        $imagesrc = $imagetag->getAttribute('src');   
        $image['link'][$i] = NULL;
        if (isset($imagelinked['src'][$indexlinked]) && $imagesrc == $imagelinked['src'][$indexlinked]) {
          $image['link'][$i] = $this->convertLink($domain,$url,$imagelinked['link'][$indexlinked]);
          $indexlinked++;
        }
        $image['src'][$i] = $this->convertLink($domain,$url,$imagesrc);
      }  
      return $image; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tryed mylyn but i cant find that feature, if anyone have test mantis
We have an error that we can't seem to find and don't have the
This may have been answered before, but I cannot find a solution that works.
I have built a .dll under WinXP that claims it can't find DWMAPI.DLL when
I have android.permission.READ_OWNER_DATA but I can't find any reliable code that would explain how
I've looked at the Python Time module and can't find anything that gives the
My dad always says Responsibility without Authority is meaningless. However, I find that as
I have read many post indicating that we can't send sms on Missed Call,
So, I've been looking all over. I can't find anywhere that talks about specifically
I can't seem to find that option. Surely it's in there?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.