Thanks everyone! I am unsure how to use Robert's API as I haven't been
able to find any documentation, but that may be a better idea given
the security issue that Jason raised. Does anyone know where I could
find some examples of its usage?

Thanks again,

Ben

On Jan 13, 4:55 pm, "William Stein" <wst...@gmail.com> wrote:
> On Tue, Jan 13, 2009 at 7:15 AM, ben <m...@matix.co.uk> wrote:
>
> > Hello,
>
> > I'm trying to communicate with sage using PHP. I want it to calculate
> > 1+2. I've written this little bash script:
>
> > #!/bin/bash
> > cd /usr/local/sage-3.2.1
> > ./sage  -q << END
> > 1+2
> > END
> > read -p "Press enter to continue"
>
> > which outputs:
>
> > sage: 3
> > sage:
> > Exiting SAGE (CPU time 0m0.04s, Wall time 0m0.04s).
> > Press enter to continue
>
> > however, when I execute the script from PHP using this:
>
> > echo exec("cd /home/ben/Desktop && ./test.sh",$out);
> > print_r($out);
>
> > it outputs:
>
> > **********************************************************************
> > Welcome to IPython. I will try to create a personal configuration
> > directory  where you can customize many aspects of IPython's
> > functionality in: /root/.sage/ipython  Initializing from
> > configuration /usr/local/sage-3.2.1/local/lib/python2.5/site-packages/
> > IPython/UserConfig Please press  to start
> > IPython.**********************************************************************
> > Press enter to exit:
>
> > why do I not get the same output as when I execute the script
> > directly? is there any way stopping the welcome message being output
> > every time? how can I get the answer 3?
>
> For 1-liners use "sage -c":
>
> wst...@sage:~$ sage -c "print 1 + 2"
> 3
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to