On Sun, Jul 11, 2010 at 2:03 PM, Toshio Kuratomi <a.badger(a)gmail.com> wrote:
A few other differences between the python-fedora implementation and
this:
* I think that giving "username=XXX" as a param will yield an error.
* I think you need to have FOLLOWLOCATION=True so you follow redirects.
Here's what I *think* is php to implement that:
- curl_setopt($ch, CURLOPT_USERAGENT, "Drupal AuthFAS 0.1");
- curl_setopt($ch, CURLOPT_POSTFIELDS,
"username=".urlencode($username)."&user_name=".urlencode($username).
"&password=".urlencode($password)."&login=Login");
+ curl_setopt($ch, CURLOPT_HEADERS, "user-agent: Drupal AuthFAS 0.1; Accept:
application/json;");
+ curl_setopt($ch, CURLOPT_POSTFIELDS, "user_name=".urlencode($username).
"&password=".urlencode($password)."&login=Login");
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1)
+ curl_setopt($ch, CURLOPT_MAXREDIRS, 5)
I could be off in the bushes with this, though. If so, here's the
python-fedora code that connects to FAS. Checking for differences in what
you're giving curl and what it's giving curl is pretty straightforward:
http://bzr.fedorahosted.org/bzr/python-fedora/python-fedora-devel/annotat...
-Toshio
For blogs.fp.o, we used php and json to get the authentication working.
Here's a link to the code that does this:
http://git.fedorahosted.org/git/?p=fedora-infrastructure.git;a=blob;f=plu...
Hopefully this is of help.
Sijis