woocommerce/classes/gateways/mijireh/includes/RestJSON.php

25 lines
678 B
PHP
Raw Normal View History

2012-06-08 10:46:10 +00:00
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2012-06-08 10:46:10 +00:00
class Mijireh_RestJSON extends Mijireh_Rest {
public function post($url, $data, $headers=array()) {
return parent::post($url, json_encode($data), $headers);
}
public function put($url, $data, $headers=array()) {
return parent::put($url, json_encode($data), $headers);
}
protected function prepRequest($opts, $url) {
$opts[CURLOPT_HTTPHEADER][] = 'Accept: application/json';
$opts[CURLOPT_HTTPHEADER][] = 'Content-Type: application/json';
return parent::prepRequest($opts, $url);
}
public function processBody($body) {
return json_decode($body, true);
}
}