Hi, I am a newbee and for my project i have to call a C bin from the cgi- bin rep of my host ,i want to call the script from my controller...I''am sure it''s a trivial question but i havent found the answer on google, I hope that someone could show my the right solution, here the Php script to call the CGI I want to do something like that in my rails app function urlSPPlus($urlCGI) { $handle = fopen($urlCGI, "rb"); if (!$handle) { return "Error cgi script."; } $contents = fgetss($handle, 2048); fclose($handle); list($debut,$url,$fin) = split("''", $contents, 3); return $url; } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 14 Mar 2008, at 09:06, Ecrevisse06 wrote:> > Hi, > I am a newbee and for my project i have to call a C bin from the cgi- > bin rep of my host ,i want to call the script from my > controller...I''am sure it''s a trivial question but i havent found the > answer on google, I hope that someone could show my the right > solution,IO.popen is probably what you want. Fred> > > here the Php script to call the CGI I want to do something like that > in my rails app > > function urlSPPlus($urlCGI) > > { > $handle = fopen($urlCGI, "rb"); > if (!$handle) { return "Error cgi script."; } > $contents = fgetss($handle, 2048); > fclose($handle); > list($debut,$url,$fin) = split("''", $contents, 3); > return $url; > } > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks Fred, for yout help But I think I don''t undesrtand something I have made some test cgi-bin/hello.rb=> simple hello world so in my controller: IO.popen("../../../cgi-bin/hello.rb", "w+") do |pipe| pipe.close_write output = pipe.read @output=output end in my view <%=@output%> => "hello world" its ok but when i use the same script for the hmac_demo.exe (the real cgi given by my bank) the result in my view is an error with pipe.puts "my params" text/html Status: 0 Unknown Request Method Error 407 Unknown Request Method Only POST or GET request methods are available So I made a new test like that : @urlcgihmac = "../../../cgi-bin/hmac_wahine_decoration.exe" @urlhmac = "#{@urlcgihmac}? montant=#{@montant}&reference=#{@reference}&email=#{@email}&langue=#{@langue}&moyen=#{@moyen}&modalite=#{@modalite}" IO.popen("#{@urlhmac}", "w+") ...ect but with that in my view I''haven''t got any result please help me! On Mar 14, 10:11 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 14 Mar 2008, at 09:06, Ecrevisse06 wrote: > > > > > Hi, > > I am a newbee and for my project i have to call a C bin from thecgi- > > bin rep of my host ,i want to call the script from my > > controller...I''am sure it''s a trivial question but i havent found the > > answer on google, I hope that someone could show my the right > > solution, > > IO.popen is probably what you want. > > Fred > > > > > here the Php script to call theCGII want to do something like that > > in my rails app > > > function urlSPPlus($urlCGI) > > > { > > $handle = fopen($urlCGI, "rb"); > > if (!$handle) { return "Errorcgiscript."; } > > $contents = fgetss($handle, 2048); > > fclose($handle); > > list($debut,$url,$fin) = split("''", $contents, 3); > > return $url; > > }--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---