Jump to content

[SOLVED] $var = file('http... gives parse error


johnnyboy

Recommended Posts

hello I get a parse error when I assign an external file to a variable.

 

I deleted the entire file except

<?php

$lines = file('http://www.example.com/myfile.txt');

?>

 

I get

Parse error: syntax error, unexpected T_VARIABLE in /home/restofpath/file.php on line 3

 

what gives, this example i took directly from the php manual

any help appreciated

 

johnny

 

 

Link to comment
Share on other sites

pksml , thanks for the tips.

 

I changed the url because i did not want to post it here, but the one I use is a real url.

 

fopen works on my server, but I wanted to use file()

 

ok, I apologize for this post because I fear that I have just been an idiot.

 

there was a period in one of the blank lines that was causing the error

it now works fine.

 

thanks pksml

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.