suppress error using fread()
<p>I wrote a script for screen pops from our soft phone that locates a directory listing for the caller but occasionally they get "Can't read input stream" and the rest of the script quits.</p>

<p>Does anyone have any suggestions on how to suppress error the error message and allow the rest of the script to run? Thanks!</p>

<pre><code>$i=0;

    $open = fopen("http://www.411.ca/whitepages/?n=".$_GET['phone'], "r"); 
    $read = fread($open, 9024); 
    fclose($open); 
    eregi("'/(.*)';",$read,$got);
    $tv = ereg_replace('[[:blank:]]',' ',$got[1]);
    $url = "http://www.411.ca/".$tv;
    while ($name=="unknown" &amp;&amp; $i &lt; 15) { ## try 15 times before giving up
    $file = @ fopen($fn=$url,"r") or die ("Can't read input stream");
    $text = fread($file,16384);
    if (preg_match('/"name"&gt;(.*?)&lt;\/div&gt;/is',$text,$found)) {
            $name = $found[1];
    } 
    if (preg_match('/"phone"&gt;(.*?)&lt;\/div&gt;/is',$text,$found)) {
            $phone = $found[1];
    } 
    if (preg_match('/"address"&gt;(.*?)&lt;\/div&gt;/is',$text,$found)) {
            $address = $found[1];
    } 
    fclose($file);
    $i++;
    }
</code></pre>
