How to include simple-rest library in WordPress

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amskape
    New Member
    • Apr 2010
    • 56

    How to include simple-rest library in WordPress

    Dear pals,
    I need to implement the REST service which explain in Simple-rest.
    I create a file with name xyz.php with code

    Code:
        <?php
        if(isset($_POST['type']) && (isset($_POST['id']))) {
        	$type = $_POST['type']?$_POST['type']:"undefined";
        	$id = $_POST['id']?$_POST['id']:"undefined";
    
        	//echo "val is :".$type." id is ".$id;
        } else {
        $type = "table";
        $id = 2;
        }
        ?>
        <?php require_once("wp-load.php");?>
        <?php //get_header();
         wp_head();
        ?>
    
        <?php
        if($type=="chart" && $id!="undefined") {
        	$kk_chart = get_html_4_chart(intval($id));
        	echo $kk_chart;
        }
        if($type=="table" && $id!="undefined") {
            $kk_table = get_html_4_table(intval($id));
        	echo $kk_table;
        }
            wp_footer();
        ?>
    in root folder work fine . But i need to make it in a controller method. So I create a folder named "services" in root of WP and create a controller with name "chart" and write code as

    Code:
        include_once("../wp-load.php");
        wp_head();
        wp_footer(); 
    
        class Controllers_Chart extends RestController {
        	public function get() {
        		//$this->response = array('TestResponse' => 'I am GET response. Variables sent are - ' . http_build_query($this->request['params']));
        		//$this->responseStatus = 200;
        		$kk_chart = get_html_4_chart(2);
        		return $kk_chart;
    
        	}
        }
    I just include the relevant get() method only . But I got some unexpected error like
    Warning: include(Transla tion/Entry.php): failed to open stream: No such file or directory in C:\wamp\www\wp-oscar\services\ index.php on line 22
    Warning: include(): Failed opening 'Translation/Entry.php' for inclusion (include_path=' C:\wamp\www\wp-oscar\services; .;C:\php\pear') in C:\wamp\www\wp-oscar\services\ index.php on line 22

    alot of warning like this and a Fatal error as
    Fatal error: Call to a member function set_filenames() on a non-object in C:\wamp\www\wp-oscar\wp-content\plugins \wp-business-intelligence-lite\functions\ functions.php on line 174

    please advise me a method to call WordPress Business Intelligence intelligence as a REST service .

    Waiting your reply

    Thanks,
    Anes
    Last edited by Rabbit; Sep 29 '13, 05:26 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
Working...