• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

How to create web api to extract oracle data using php

Hi,
We have oracle database installed and would like to share our data with others. I would like to develop a simple web service that provide other application to pull data from oracle database for their own use.

I want to use php to start with because this language is the one that I am familiar with compare to any other language. I had developed few interfaces in php to do (create, read, update & delete) CRUD functionalities. We are using Apache as our web server.

For web api, honestly this is something new for me. I need to know how to do the following, assuming extracting employee table from sample table of oracle database (SCOTT account/schema) - (copying data to new table)

1. Create web-api in php to extract employee table (all columns) and output in JSON format.
2. Create php to call this web-api to read extracted employee record (JSON format) and save it to new_employee table under same schema.
3. How to include authentication to this web-api ? so that only specific client can access to this service.

Please don't give me bunch of links unless it really really help me to do specific task as above. I consider myself as beginner to this.  I have read a lot but seems does not giving me better understanding on how to do it, especially using php.

Thanks in advance.
0
VW 63654
Asked:
VW 63654
1 Solution
 
Walter RitzelSenior Software EngineerCommented:
Unfortunately, links will be required to do this explanation.
The links below are a good start:
http://coreymaynard.com/blog/creating-a-restful-api-with-php/
http://www.phpgang.com/how-to-create-restful-api-webservice-with-slim-php-and-mysql_588.html

They explain in detail how to create the web api in PHP.

Now, this is an ebook very interesting about developing web apis:
https://pages.apigee.com/web-api-design-ebook.html

Besides that, I can provide to you an example of a web api in Python.
0
 
Ray PaseurCommented:
Have a look at this article.  I've been through the process and written it up!
http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/A_12239-Introduction-to-Application-Programming-Interfaces.html

Today, this would be a little different (technology is always advancing).  I might consider a PHP framework like Laravel or Slim.  I don't know Slim very well, but I'm quite familiar with Laravel and it's very talented in the API space.  Also, I would not use XML return values today - JSON is a better transport mechanism.  PHP has JSON functions that can package arrays and objects for over-the-web transport.
http://php.net/manual/en/ref.json.php

But having said that, the API concept is all about performance.  You may want to get closer to the "bare metal" implementation if you find the framework impedes performance.  Frameworks are supposed to make programming easier, and this usually comes at some expense in performance.  Consider cacheing the responses with ReDiS or memcacheD if performance is an issue.

If you have to send binary-safe data, learn about base64 encoding.
http://php.net/manual/en/function.base64-encode.php

Authentication is usually a combination of IP address, HTTP referrer, and API key.  The article covers some of this.

You will need some background in how HTTP request/response protocols work.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/A_11271-Understanding-Client-Server-Protocols-and-Web-Applications.html

That's about it.  If you read those resources and still have specific questions about how to get started, please post back and we will try to help.
0
 
VW 63654Author Commented:
Thanks for giving me all the links.

Ray, I like the article that you send. Very basic and brief intro on API.
I will have a look first and trying to find out where can I make a quick start.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now