I am trying to retrieve text from a `doc` file using `php`. This is the code that I am using:

```
    function read_doc() {
        foreach (glob("*.doc") as $filename) {

            $file_handle = fopen($filename, "r"); //open the file
            $stream_text = @fread($file_handle, filesize($filename));
            $stream_line = explode(chr(0x0D),$stream_text);
            $output_text = "";
            foreach($stream_line as $single_line){
                $line_pos = strpos($single_line, chr(0x00));
                if(($line_pos !== FALSE) || (strlen($single_line)==0)){
                    $output_text .= "";
                }else{
                    $output_text .= $single_line." ";
                }
            }
            $output_text = preg_replace("/[^a-zA-Z0-9\s\,\.\-\n\r\t@\/\_\(\)]/", "", $output_text);
            echo $output_text;
        }
}

```

I get this result:

> 
> HYPERLINK mailtoAnother@email.us Another@email.us Y, dXiJ(x(I\_TS1EZBmU/xYy5g/GMGeD3Vqq8K)fw9 xrxwrTZaGy8IjbRcXI u3KGnD1NIBs RuKV.ELM2fiVvlu8zH (W uV4(Tn 7\_m-UBww\_8(/0hFL)7iAs),Qg20ppf DU4p MDBJlC5 2FhsFYn3E6945Z5k8Fmw-dznZxJZp/P,)KQk5qpN8KGbe Sd17 paSR 6Q
> 
> 
> 

Is there some solution which would clear this up so it returns just a `string` of text from the `doc` file?