PHP和Wordpress如何从远程文件中读取某些行

I'm trying to read certain lines from a remote file being the code

                    // get bio from remote servers from line 835 to 859
                $userbio = fopen("http://example.com/".$db->username, 'r');
                $lineNo = 0;
                $startLine = 865;
                $endLine = 892;
                while ($line = fgets($userbio)) {
                    $lineNo++;
                    if ($lineNo >= $startLine) {
                        echo $line;
                    }
                    if ($lineNo == $endLine) {
                       break;
                    }
                }
                fclose($userbio);

And this works great on a single php file, but when inside Wordpress all I get is Resource ID #164. Any other way of doing this remote read? thank you

Try file_get_contents() function, for guide visit w3school