# PHP and Ruby Code Integration Problem

**URL:** <https://www.ruby-forum.com/t/php-and-ruby-code-integration-problem/133632>\
**Category:** Rails\
**Created:** [April 2, 2008, 5:15am UTC](https://www.ruby-forum.com/t/php-and-ruby-code-integration-problem/133632 "2008-04-02T05:15:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![myowntribe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@myowntribe](https://www.ruby-forum.com/u/myowntribe)\
**Post date:** [April 2, 2008, 5:15am UTC](https://www.ruby-forum.com/t/php-and-ruby-code-integration-problem/133632/1 "2008-04-02T05:15:11Z")

</div>

Hi,

I am working on the UI for an existing shopping cart which has been done  
on Php, I need to set up a front end on RoR. I have these doubts, could  
anyone please help me with them…

Is it possible to integrate Php backend with RoR frontend?

Can we use XML to send data backwards and forwards from the UI and the  
PHP backend? Can we have data being read by a php processing script,  
which updates the db and returns appropriate values?

Please do let me know.

Cheers  
Cass

---

<div class="post-metadata">

**Author:** ![myowntribe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@myowntribe](https://www.ruby-forum.com/u/myowntribe)\
**Post date:** [April 2, 2008, 6:50am UTC](https://www.ruby-forum.com/t/php-and-ruby-code-integration-problem/133632/2 "2008-04-02T06:50:26Z")

</div>

Hi Julian,

Thanks for your reply, well actually, our shopping cart has been built  
on PHP and now we are planning to have a UI built on RoR, I was just  
wondering if we can use XML to send data backwards and forwards from the  
UI and the  
PHP backend? Can we have data being read by a php processing script,  
which updates the db and returns appropriate values?

Cheers

Cass

Julian L. wrote:

> Hi Cass,
> 
> What do you mean by backend and frontend?
> 
> Ruby is used a server-side language, with the web browser as the front  
> end, so your words are a little jumbled, I think.
> 
> Do you mean you’ll have one (Rails) app doing the interface without  
> talking to the database?
> 
> Julian
> 
> Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO  
> OUT 3rd APRIL  
> [http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![myowntribe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@myowntribe](https://www.ruby-forum.com/u/myowntribe)\
**Post date:** [April 2, 2008, 6:07am UTC](https://www.ruby-forum.com/t/php-and-ruby-code-integration-problem/133632/3 "2008-04-02T06:07:20Z")

</div>

Hi Cass,

What do you mean by backend and frontend?

Ruby is used a server-side language, with the web browser as the front  
end, so your words are a little jumbled, I think.

Do you mean you’ll have one (Rails) app doing the interface without  
talking to the database?

Julian

Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO  
OUT 3rd APRIL  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![myowntribe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@myowntribe](https://www.ruby-forum.com/u/myowntribe)\
**Post date:** [April 2, 2008, 7:06am UTC](https://www.ruby-forum.com/t/php-and-ruby-code-integration-problem/133632/4 "2008-04-02T07:06:01Z")

</div>

Ah, okay.

Yes, you can do that. You might also want to have the PHP script and  
the RAILS app talking to the same database. Not great fun for managing  
the source code, but possible.

Julian

Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO  
OUT 3rd APRIL  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![myowntribe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@myowntribe](https://www.ruby-forum.com/u/myowntribe)\
**Post date:** [April 2, 2008, 7:46am UTC](https://www.ruby-forum.com/t/php-and-ruby-code-integration-problem/133632/5 "2008-04-02T07:46:40Z")

</div>

Hi Julian,

Thanks for the reply, thats encouraging for me, if I may ask, could you  
help me in getting my app up? I could actually pay your for your  
services, for guiding me, if you can give me your email id, I can talk  
to you personally…

Cheers  
Cass  
removed\_email\_address@domain.invalid

Julian L. wrote:

> Ah, okay.
> 
> Yes, you can do that. You might also want to have the PHP script and  
> the RAILS app talking to the same database. Not great fun for managing  
> the source code, but possible.
> 
> Julian
> 
> Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO  
> OUT 3rd APRIL  
> [http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![myowntribe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@myowntribe](https://www.ruby-forum.com/u/myowntribe)\
**Post date:** [April 3, 2008, 9:51am UTC](https://www.ruby-forum.com/t/php-and-ruby-code-integration-problem/133632/6 "2008-04-03T09:51:04Z")

</div>

I’d recommend you take a look at JSON as an alternative to XML for  
communicating between Rails and PHP. The support for JSON on both  
sides is good and it supports all the common data types (strings,  
numbers, arrays, etc).
