PHP's file_get_contents () and cookies
06.12.06 01:16 |
Code
Sending cookies - you can do it with
file_get_contents () - just look at the stream
functions' constants (the context parameter). But I
found out it's much easier using the curl plugin
(which isn't always available, btw, but neither is
file_get_contents ()):
It's that simple. An awesome tool for creating all kinds of site parsers.
$c = curl_init ($url);
curl_setopt ($c, CURLOPT_VERBOSE, 1); // For testing
curl_setopt ($c, CURLOPT_COOKIE, "variable=value");
curl_exec ($c);
It's that simple. An awesome tool for creating all kinds of site parsers.
|