Jump to content

[SOLVED] File parsing a line from other server.


cgimusic

Recommended Posts

I guess this is a lot of questions but it is all for one thing I am trying to accomplish. I basically want to get line 49 from a document on a remote server, save it as a variable then run something like a find and replace on that variable and save it as another variable and echo it. The only code I have so far is:

 

<?php
$file = implode('', file('http://server/dir/file.xml'));
echo $file
?>

 

Can anyone help me. I'm still quite new to this.

Do:

$file = file('http://server/dir/file.xml');

echo $file[48]; // line 49

 

file() returns an array of each line in the file.

 

Great, thanks. I was trying that earlier but I didn't realize that you had to put the number down one. Does anyone have any idea to do something along the lines of a find and replace?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.