0

This seems like it would be the most basic thing, maybe so basic that no one bothers to mention it. I've learned all the basic PHP syntax and some functions like fread() and fopen(), but I can't find a good way to download a URL into a string. Right now my best attempt is:

$someFile = fopen("http://www.pastats.com/report/winners?start=1386916400&duration=86400", r);
$someData = fread($someFile, filesize("http://www.pastats.com/report/winners?start=1386916400&duration=86400") );

but it doesn't work because apparently filesize doesn't work if I don't have write permissions. I know there's got to be a really simple way of doing this.

1 Answer 1

1

Assuming your permissions are set correctly (allow_url_fopen set to true), which it sounds like it is, then file_get_contents() is your best bet. Otherwise you'll want to use PHP's cURL functions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.