OpenCPU uses HTTP POST to execute functions, and HTTP GET to read/render objects and graphs. You could start with saving your function to the temporary store, and then calling it from there. A basic example is given in the "/R/tmp API" chapter of the interactive manual. If you click the red demo buttons named save a function, get the function and call the function it will work you through the steps. 

Basically in the first step you do a HTTP POST to the identity function to save your function in the store. This is also what is being done in the third form of the running code example page that you found. So I just copied your code there and then it returned me the object x0188b9b9ce.

To inspect if everything went OK, you can then read this object using HTTP GET. For example, open this url to read the source code of your function:

http://public.opencpu.org/R/tmp/x0188b9b9ce/ascii


Alternative outputs are for example to get the function as an RData file:

http://public.opencpu.org/R/tmp/x0188b9b9ce/rda


Important is that HTTP GET never executes functions. It just looks stuff up, and returns it in the output format that you requested. So now that you're convinced your function is there in the store we want to run it. To do this you need a HTTP POST again. For example to obtain a PDF, you can do

POST http://public.opencpu.org/R/tmp/x0188b9b9ce/pdf
POST http://public.opencpu.org/R/tmp/x0188b9b9ce/svg
POST http://public.opencpu.org/R/tmp/x0188b9b9ce/png


If the function you calling takes arguments, you include them as parameters to the HTTP POST request. When you want to include the output in your webpage, usually you only want to use HTTP POST in combination with the /save output type. So you would use jquery or whatever to do:

POST http://public.opencpu.org/R/tmp/x0188b9b9ce/save


Which might return something like this:

{
    "object" : null,
    "graphs" : [
        "x2acba9501a"
    ],
    "files" : {}
}


This indicates that your function has been executed successfully, and it created a plot (yay!). The graphic was saved to the tmp store. So you can now obtain the graphic and embed it in your page using HTTP GET:

http://public.opencpu.org/R/tmp/x2acba9501a/png
http://public.opencpu.org/R/tmp/x2acba9501a/png?!width=900&amp;!height=500
http://public.opencpu.org/R/tmp/x2acba9501a/pdf
http://public.opencpu.org/R/tmp/x2acba9501a/svg


Interacting with openCPU
I am wondering why basePath() print nothing in layout.phtml. I am using zend skeleton Application. Does virtual host can make this problem?
Here is the code snippet and output. 

echo $this-&gt;headLink(array('rel' =&gt; 'shortcut icon', 'type' =&gt; 'image/vnd.microsoft.icon', 'href' =&gt; $this-&gt;basePath() . '/img/favicon.ico'))
                        -&gt;prependStylesheet($this-&gt;basePath() . '/css/style.css')
                        -&gt;prependStylesheet($this-&gt;basePath() . '/css/bootstrap-theme.min.css')
                        -&gt;prependStylesheet($this-&gt;basePath() . '/css/bootstrap.min.css');


HTML Output

        &lt;link href="/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css"&gt;
&lt;link href="/css/bootstrap-theme.min.css" media="screen" rel="stylesheet" type="text/css"&gt;
&lt;link href="/css/style.css" media="screen" rel="stylesheet" type="text/css"&gt;
&lt;link href="/img/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon"&gt;


How i solve this. Help will highly appreciated. Thanks in advance.
