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

  • Home
  • SEARCH
  • 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 7905363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:26:50+00:00 2026-06-03T10:26:50+00:00

I keep getting this error from my code and I have no idea what

  • 0

I keep getting this error from my code and I have no idea what I am doing wrong, this happens on occasions and it seems to work when it wants to

error

 Call to a member function find() on a non-object in C:\xampp\htdocs\sites\P\Find.php on line 265

I’ve basically created a crawler which searches a webpage for an element on the webpage, sometimes this element may not be present on the page, and I check for this by using the if statement.

line 265 refers to

if($page->find('div#olpDivId span.price'))

code

   $page = file_get_html('http://www.amazon.co.uk/dp/0304362212');

   if($page->find('div#olpDivId span.price')){
        foreach($page->find('div#olpDivId span.price') as $p){
            $i[] = floatval($p->plaintext);                 
        }
    }

if the book does not exist the crawler goes to a blank “sorry product does not exist” page
Am I doing something wrong? any help would be appreciated

  • 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-06-03T10:26:51+00:00Added an answer on June 3, 2026 at 10:26 am

    file_get_html can return false (if it was unable to fetch content from webpage), so you should check for it before using any method on $page

    $page = file_get_html('http://www.amazon.co.uk/dp/0304362212');
    
    if($page !== FALSE){
        foreach($page->find('div#olpDivId span.price') as $p){
            $i[] = floatval($p->plaintext);                 
        }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I keep getting this error, I'm trying to get tweets from twitter via
I'm trying to use slime from CVS (2009-01-05) but keep getting this error: LOAD:
I keep getting this error System.Web.HttpException was unhandled by user code Message=Validation of viewstate
I keep getting this error all over the place where I only have jquery
I keep getting this error whenever I call gethostbyname() in my C code. ==7983==
I keep getting this error on my views. I can't work it out as
I keep getting this error: Invalid Signature - This error occurs when you have
I keep getting this error after my code has run between 5-10 min CallbackOnCollectedDelegate
I have this header file ... for some reason I keep getting an error
Keep getting this error after inserting a subdatasheet into a query and trying to

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.