cURL request to plugin repository fails 403

Thanks to the WordPress forums someone answered that this only works via PHP if you set the UserAgent to a browser.

$ua="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13";
curl_setopt( $cd, CURLOPT_USERAGENT, $ua);