Problem with SimpleHTMLDom
<p>I've run in to a problem with a PHP script using SimpleHTMLDOM to pull a list of URLs of a page.</p>

<p>If I specify the URL I want to read the links off, the script gives me no problems:</p>

<pre><code>          $url='http://www.example.com';

          $blogpost = file_get_html($url);
          foreach ($blogpost-&gt;find('a[href*=example1]') as $example1link) {
              $example1link = $example1link-&gt;href;
              echo $example1link;
          }
</code></pre>

<p>All this does is pull from www.example.com all the links to www.example1.com and echo it back to me.</p>

<p>But when I try to feed the script a text file with URLs:</p>

<pre><code>  $urlarray = split("\n", file_get_contents('urls.txt'));

     foreach ($urlarray as $url) {

          $blogpost = file_get_html($url);
          foreach ($blogpost-&gt;find('a[href*=example1]') as $example1link) {
              $example1link = $example1link-&gt;href;
              echo $example1link;
          }
  }
</code></pre>

<p>It gives me the following error:</p>

<pre><code>Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty  
in simple_html_dom.php  on line 39
</code></pre>

<p>For those that don't have simple_html_dom.php this is the function the error refers to:</p>

<pre><code>function file_get_html() {
  $dom = new simple_html_dom;
  $args = func_get_args();
  $dom-&gt;load(call_user_func_array('file_get_contents', $args), true);
  return $dom;
 }
</code></pre>

<p>I can even echo $url right before I assign the value to $blogpost. The problem seems to be in passing the $url variable to file_get_html(). But only when I use a txt file with target links to scrape.</p>

<p>I'm very new to PHP (and programming in general) and I've searched around almost all day and cannot find what I'm doing wrong.</p>

<p>Any help is appreciated. </p>

<p>Thanks!</p>
