I want to open a file on a remote server (e.g. http://example.org/script.php?param=000001
). PHP provides several of those methods and I was wondering which method I should take and why? Are there any advantages/disadvantages?
So far I used fopen()
, but after several reading-operations it happens that the server did not answer my request and fopen() failed. Afterwards I tried file_get_contents()
, which also failed.
I thought it might be the server that blocked my IP, since I opened to many streams. Could this also happen with file_get_contents()
?
Which method should I use, When I want to open many files on a server?
What is the technical difference between fopen()
and file_get_contents()
? And why should the server block my IP? (e.g. servers have limited number of open file streams,... or fopen needs more ressources)