Jump to content

Recommended Posts

Dear pals,
    I need to implement the REST service which explain in Simple-rest.
    I create a file with name xyz.php with 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

    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(Translation/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
 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.