[wp-hackers] POST with XML headers
Dion Hulse (dd32)
wordpress at dd32.id.au
Fri Sep 16 15:13:29 UTC 2011
You'll need to look into using the wp_remote_*() set of functions,
which are part of the new HTTP API in WordPress.
adapted from kovshenin's link, the curl command you've got would be
similar to this:
$url = 'https://company.freeagentcentral.com/company/users';
$username = 'your-username';
$password = 'your-password';
$headers = array(
'Authorization' => 'Basic ' . base64_encode( "$username:$password" ),
'Accept' => 'application/xml',
'Content-Type' => 'application/xml'
$result = wp_remote_get( $url, array( 'headers' => $headers ) );
Dion / @dd32
On 17 September 2011 00:54, Tom Barrett <tcbarrett at gmail.com> wrote:
> I'm looking at hooking into the free agent central API (
> This is there command line curl syntax:
> curl -u userid:password -H 'Accept: application/xml' -H 'Content-Type:
> application/xml' \
> My experience with curl related fetching of remote urls in WordPress is
> limited to wp_remote_fopen() which just takes the url as an argument. I've
> had a read through wp-includes/functions.php without seeing anything that
> would let me POST with xml headers. But I'm prone to missing things.
> Is there a something in WordPress for me to hook into to do this? Or is this
> just a job for curl from basics without any WordPress goodness wrapped
> around it?
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers