Author |
|
kev21986 Senior Member
Joined: April 04 2007 Location: United States
Online Status: Offline Posts: 199
|
Posted: May 12 2009 at 17:22 | IP Logged
|
|
|
Is there an eval function? I am basically looking for a way to pass a formula to PH through a psp page with ph_getwebparm. Is this possible?
__________________ Kevin Smith
@respectTheCode
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: May 13 2009 at 07:36 | IP Logged
|
|
|
You want ph_formula() for your eval function.
|
Back to Top |
|
|
kev21986 Senior Member
Joined: April 04 2007 Location: United States
Online Status: Offline Posts: 199
|
Posted: May 13 2009 at 09:15 | IP Logged
|
|
|
TonyNo wrote:
You want ph_formula() for your eval function. |
|
|
Thanks. Ill try it tonight.
__________________ Kevin Smith
@respectTheCode
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: May 14 2009 at 22:01 | IP Logged
|
|
|
Depending upon how I interpret your question, you may also want to look at the PH cgi function evalformula.
It takes two parameters, formula and nexturl, and allows you to submit a formula for evaluation to the PH webserver. A simple URL would look like this:
Code:
http://127.0.0.1/ph-cgi/evalformula?formula=ph_macro("YOUR MACRO ID")&nexturl=YOURPSPPAGE.PSP |
|
|
Dave.
|
Back to Top |
|
|
kev21986 Senior Member
Joined: April 04 2007 Location: United States
Online Status: Offline Posts: 199
|
Posted: May 15 2009 at 06:42 | IP Logged
|
|
|
dhoward wrote:
Depending upon how I interpret your question, you may also want to look at the PH cgi function evalformula.
It takes two parameters, formula and nexturl, and allows you to submit a formula for evaluation to the PH webserver. A simple URL would look like this:
Code:
http://127.0.0.1/ph-cgi/evalformula?formula=ph_macro("YOUR MACRO ID")&nexturl=YOURPSPPAGE.PSP |
|
|
Dave.
|
|
|
That is even better than what I was looking for.
evalformula isn't working for me, but formula is working great. One thing to note is that the formula needs to be URLEncoded. It looks like it will take a POST and that wouldn't.
Quick proof of concept
Code:
http://10.1.10.2:8080/ph-cgi/formula?formula=ph_devicecontro l(%22INSTEON%2BMSTR_FAN%2BOFF%22) |
|
|
Edited by kev21986 - May 15 2009 at 06:43
__________________ Kevin Smith
@respectTheCode
|
Back to Top |
|
|
kev21986 Senior Member
Joined: April 04 2007 Location: United States
Online Status: Offline Posts: 199
|
Posted: May 15 2009 at 06:49 | IP Logged
|
|
|
What about something like this
Code:
http://10.0.10.2:8080/ph-cgi/formula?formula=ph_getinsteonle vel(%22MSTR_FAN%22) |
|
|
This returns a full html page with the result in the middle of it. Is there a way to get just the result?
__________________ Kevin Smith
@respectTheCode
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: May 15 2009 at 11:15 | IP Logged
|
|
|
Kevin,
evalformula most likely worked (you can check the log), it just doesnt return the result to you. Its good to launch a macro or other command where you're not interested in the result and instead want to navigate to a particular page when done.
What you're looking for is /ph-cgi/eval. It takes a single parameter "formula". This will return the result only without any other data.
Also, look at the ph_htmlescape function for URLEncoding.
Hope this helps,
Dave.
|
Back to Top |
|
|
kev21986 Senior Member
Joined: April 04 2007 Location: United States
Online Status: Offline Posts: 199
|
Posted: May 15 2009 at 11:40 | IP Logged
|
|
|
dhoward wrote:
evalformula most likely worked (you can check the log), it just doesnt return the result to you. Its good to launch a macro or other command where you're not interested in the result and instead want to navigate to a particular page when done.
|
|
|
that makes sense.
dhoward wrote:
What you're looking for is /ph-cgi/eval. It takes a single parameter "formula". This will return the result only without any other data.
|
|
|
I will give that a try tonight.
__________________ Kevin Smith
@respectTheCode
|
Back to Top |
|
|