On 7/4/07, Alan Milnes <alan@xxxxxxxxxxxxxxxxxxx> wrote:
I have spent the afternoon trawling the web for how to retrieve a Yahoo Groups Web Page using PHP. The best option seems to be curl, which is installed on my host. I need to understand how to set the cookies so that Yahoo accepts my response. The code I have is:- $url="http://uk.groups.yahoo.com/group/gameplan/message/17162"; $c = curl_init ($url); curl_setopt ($c, CURLOPT_VERBOSE, 1); // For testing curl_setopt ($c, CURLOPT_COOKIE, "PU='t=2'"); curl_setopt ($c, CURLOPT_COOKIE, "B='fjdqm0h38nja8&b=3&s=en'"); curl_setopt ($c, CURLOPT_COOKIE, "G='v=7&data=aV_mWZSWJqXQjMVAffABJZF90G5YVfEqEKS_8sCOGC3UJKe0r0CgoZ9Ys5lC44k1cNbU1Es8YvlWBV8HeBernGvtIA-WSq4kLkSKiwcQMo-uYLWwGFoQogK4oDv-rdb1JieLv7LLxUJvjCmZu8wAfBp8WO9dBI4gkypKEQK88Tcgb47bGiHVRZssV0LYodF64CAmb78Cu3I51FOXw1iZbUE76-qwQo2nz_qm-z21RwG8Tnm9yMed8ge588576Tqtxf7ebc3v06bvVYknMxT3AuuLpzSXb3MbyBxWXousng1nkcdooFGrFlVfSwcbl2scqfr8hBOoJLeoPdY6_aLrEtZghtVg1tvwclO3fSvXVa7TBhhHHzJ1JrD7_q-8mN140EjYon9Z4ump3lh6NHerJHlKE63J0t-syUMDNo3muAzYFQulYjQ&n=8'"); curl_exec ($c); The page outputs:- "Aren't you supposed to be somewhere else?" I'm guessing that perhaps the cookies aren't being set properly. Any pointers / articles / sites? Can I use a cookies.txt file from a valid visit to the site to set this up?
Use curl_setopt() to let curl save the cookies. Specifically you need these two options: CURLOPT_COOKIEFILE CURLOPT_COOKIEJAR http://us2.php.net/manual/en/function.curl-setopt.php -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php