PHP Error : Continuing script execution
<p>I am getting error in one of php script.I wan the execution continued avoiding the error.It's a fatal error.I also want to write the error in a file.I have the functionality to write the error.Now i need to get the error as text written in the log file.And continue the execution.
Can any one help me with this?</p>

<p>Thanks in advance</p>

<p>Please also take a look at the code and current error..i tried with both exception and conditional statement.I can't get the error as a string.How can i get that and continue execution ?</p>

<pre><code>  foreach ($this-&gt;NewsSectionURLObject as $newsSection)
        {
            //0-NewssectionID
            //1-NewsSectionURL
            //2-NewsPaper ID
            //News sectionURLID

            if ($newsSection!=null)
            {
            //  echo $i; 
                $newsectioid=$newsSection[0];
                $uri=$newsSection[1];

                    $html=file_get_html($uri);
                    $content= $html-&gt;find('div[class=leftcolumn txt]', 0);

                    try {

                    if($content-&gt;find('h1 a')!=null)    
                    {
                        foreach ($content-&gt;find('h1 a') as $contentAnalized)
                        {
                                //echo $contentAnalized;

                                $sourceURL='http://www.thedailystar.net/newDesign/'.$contentAnalized-&gt;href;

                                $this-&gt;NewsObject-&gt;SetNewsURL($sourceURL);

                                $title=str_replace("'", "", "$contentAnalized-&gt;innertext");

                                $this-&gt;NewsObject-&gt;SetNewsTitle($title);
                                $this-&gt;NewsObject-&gt;SetNewsSectionID($newsectioid);
                                $this-&gt;NewsObject-&gt;SetNewsPriority(1);
                                $this-&gt;NewsObject-&gt;SetNewsPublishDate(date("Y-m-d"));
                                $this-&gt;NewsObject-&gt;SetNewsCrawlDate(date("Y-m-d"));
                                $this-&gt;NewsObject-&gt;SetNewsPaper($this-&gt;NewsPaperManager-&gt;GetNewsPaperName(0));

                                $this-&gt;NewsManager=new NewsManager();

                                if ($this-&gt;NewsManager-&gt;IsExist($this-&gt;NewsObject-&gt;GetNewsURL())==TRUE)
                                {
                                    echo 'duplicate found';

                                }

                                else 
                                {
                                    $this-&gt;NewsTokenManager=new NewsTokenManager();
                                    $ReturnIDforToken=$this-&gt;NewsManager-&gt;InsertNews( $this-&gt;NewsObject);
                                    echo '&lt;br&gt;'.'News inserted at : '.$ReturnIDforToken.'&lt;br&gt;';

                                    $this-&gt;NewsTokenManager-&gt;InsertTokens($this-&gt;NewsObject);


                                }


                        }
                    }

                    else 
                    {
                        throw new Exception('Something went wrong');

                    }

                }

                catch (Exception $ex)
                {
                    echo $ex;
                }
</code></pre>

<p>Showing Error in the middle of execution when content is not found as :
    Fatal error: Call to a member function find() on a non-object in C:\wamp\www\NewsCube\AppWebsite\NewsController.php on line 134</p>
