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

25 lines
672 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 {
2012-11-27 16:22:47 +00:00
2012-06-08 10:46:10 +00:00
public function post($url, $data, $headers=array()) {
return parent::post($url, json_encode($data), $headers);
}
2012-11-27 16:22:47 +00:00
2012-06-08 10:46:10 +00:00
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);
}
2012-11-27 16:22:47 +00:00
2012-06-08 10:46:10 +00:00
}