I wanna put the content of a URL in a string and the process it. However, I have a problem.
I get this error:
Warning: file_get_contents(http://www.findchips.com/avail?part=74ls244) [function.file-get-contents]: failed to open stream: Redirection limit reached,
I have heard this comes due to page protection and headers, cookies and stuff. How can I override it?
I also have tried alternatives such as fread along with fopen but I guess I just don't know how to do this.
Can anyone help me please?
Try using cURL instead. cURL implements a cookie jar, while file_get_contents doesn't.
1) local simplest methods
2) Better Way is CURL:
See function code here. It automatically handles FOLLOWLOCATION problem + Remote urls are automatically re-corrected! (
src="./imageblabla.png"
-------->src="http://example.com/path/imageblabla.png"
)p.s.GNU/Linux users might need
php5-curl
package.Use
cURL
,Check if you have it via
phpinfo();
And for the code: