id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 8727 WP_Http_Curl doesn't handle cookies Denis-de-Bernardy "WP_Http_Curl doesn't handle cookies properly, and I see no means to ""fix things up"" using a plugin hook. for information, note that some hosts fail when using curl_setop() for CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE. I worked around this in one of my own classes at one point. The code I used is the following: {{{ curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('sem_http', 'curl_cookies')); }}} with: {{{ # # curl_cookies() # # via http://www.php.net/manual/en/function.curl-setopt.php#70043 # function curl_cookies($ch, $string) { global $sem_curl_cookies; # ^overrides the function param $ch # this is okay because we need to # update the global $ch with # new cookies $length = strlen($string); if ( !strncmp($string, ""Set-Cookie:"", 11) ) { # get the cookie $cookiestr = trim(substr($string, 11, -1)); $cookie = explode(';', $cookiestr); $cookie = explode('=', $cookie[0]); $cookiename = trim(array_shift($cookie)); $sem_curl_cookies[$cookiename] = trim(implode('=', $cookie)); } if ( trim($string) == """" ) { $cookie = """"; foreach ( (array) $sem_curl_cookies as $key => $value ) { $cookie .= ""$key=$value; ""; } $sem_curl_cookies = array(); #dump(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL), $cookie); curl_setopt($ch, CURLOPT_COOKIE, $cookie); } return $length; } # curl_cookies() }}} a few remarks on the above, since WP has a broader user base than the handful of customers I distributed the above to: - you'll want to use a class variable instead of a global variable - strlen isn't multi-byte safe, so there might need some tweaking here - $cookie .= ""$key=$value; ""; may need some attention. I'm uncertain how well curl behaves when $key or $value contain strings that might need to be urlencoded. else it works fine..." enhancement closed normal 2.8 HTTP API 2.7 normal fixed has-patch dev-feedback