|
Posted by NC on 05/18/06 18:28
lawrence k wrote:
>
> I'm reading over this page:
>
> http://www.php.net/manual/en/ref.curl.php
>
> What I'm missing is why?
And why not? cURL was not developed for PHP, but why not use it if
it's available?
> What problem does curl solve? What does it make easier?
> When would I use its functions, instead of simpler functions
> like file() or fsocketopen()?
Using fsockopen() is not that simple compared to cURL; you have to keep
track of redirects, cookies, etc., and remember to separate HTTP
headers from the data proper. As to file()/readfile(), PHP sometimes
experiences problems opening dynamically generated remote files via
file system functions, even with allow_url_fopen = On. Sometimes it
even generates error messages like these:
Warning: file([URL]) - Success in file.php on line X
Warning: fopen([URL], 'r') - Undefined error: 0
Cheers,
NC
Navigation:
[Reply to this message]
|