On Tue, 19 Dec 2006, Ike wrote:
>
> With the following method, I am able to execute and display a php page:
>
> def phpstuff
> require ''net/http''
> url = URI.parse(''http://127.0.0.1/phpstuff.php'')
> req = Net::HTTP::Get.new(url.path)
> res = Net::HTTP.start(url.host, url.port) {|http|
> http.request(req)
> }
> render_text res.body
> end
>
> However, let''s suppose I want to simply execute a snippet of php
code.
> If I am just running straight out of mongrel, on say port 3000 (not
> through apache), how can do that? Can I do it in the rhtml somehow?
>
> Also, is there way, from within Rails, to get back a value returned,
> say, by executing a method in php? Thanks, Ike
% php -r ''print("hello world\n");''
hello world
If you can call php via the CLI then that would work... kind of ugly, but
it would work. You can also just pass it a filename to execute and then
parse the results inside of Rails to do whatever you need to do.
-philip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---