I'm running /usr/bin/perl
or /usr/bin/php
via an NSTask and want to retrieve the HTTP headers of the program. I've properly formatted the environment (Perl requires env vars to be prefixed with HTTP_
), but neither of the task are returning anything other than raw output. I've been through the documentation on NSTask and the man pages for php and perl, and haven't seen any way to force the output of HTTP headers.
Any ideas?
EDIT: I realize this is an ancient question, but I just rediscovered it and realized I should report back. The problem was that I should've been using php-cli
, and not php
. I had to download and compile php-cli
from source to get this to work as I was expecting. Once I did, however, it worked like a charm. :)