SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
Web Services with PHP
Website
• Response will be in HTML
• Accessed by humans via web browsers
User browsing websites in HTML
Application running
on Web server
HTTP request
HTML response
Web Service
• A Web service is a method of communications between two
software applications over the World Wide Web.
• Web services are Accessed by programs/Applications.
• Response will be in XML or JSON
HTTP/ SOAP / REST request
Response in XML / JSON
Another application running
on Web server
Some Application running on a
Web server
But why I should do so?
Consider the Scenario
• Suppose you have a travel and tourism application from which users will get
updates on flight timings, train timings etc
• But for this to be practical- your application must be integrated with the
applications of all the airlines(air india, Jet air, King fisher etc) and for the train
also which is almost impractical or quire a highly expensive method
• So what you do? You go to airlines website, copy the flight times available and
enter that data on your travel application, so those details will be available to
users of your application !!
Application server of emirates airlinesApplication server of your travel application
Copy the details from
airlines website
enter the details of
airlines in your travel
application
Application server of emirates airlinesApplication server of your travel application
SOAP/HTTP/REST Webservice
User get updates on the flight details from your travel application
Using Web service
Benefits of Web Service
• Exposing the existing function on to network, so that any
software's can access
• Low Cost of communication
• Connecting Different Applications ie Interoperability. This in
turns make it possible to access the data exposed by an
application(developed in any programming language say .Net) by
another application(developed in any other language say
android/IOS/PHP etc)
Webservices
Web service
in PHP
Other Platforms
Windows(c#)
Android
Web Service Data Format Types
• The following standard data format types are supported by Service
via the HTTP protocol
• SOAP
• JSON
• CSV
• EXCEL
• XML
• PDF
• RSS
Web Service Data Format Types
• The following standard data format types are supported by Service
via the HTTP protocol
• SOAP
• JSON
• CSV
• EXCEL
• XML
• PDF
• RSS
We will be learning about web services using
json as it is the advanced methodology using
in the industry
JSON
JSON
• JavaScript Object Notation.
• JSON is syntax for storing and exchanging text information.
• JSON is language independent.
• JSON uses JavaScript syntax for describing data objects.
• JSON parsers and JSON libraries exists for many different
programming languages.
JSON Objects
• JSON objects are written inside curly brackets,
– Objects can contain multiple name/values pairs:
{ "firstName":"John" , "lastName":"Doe" }
• JSON arrays are written inside square brackets.
– An array can contain multiple objects:
{"employees": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }]
}
JSON Example
<body>
<h2>JSON Object Creation in JavaScript</h2>
<p>
Name : <span id="jname"></span> <br />
Age : <span id="jage"></span> <br />
</p>
<script>
var JSONObject= {"name":"John Johnson“,"age":33};
document.getElementById("jname").innerHTML=JSONObject.name;
document.getElementById("jage").innerHTML=JSONObject.age;
</script>
</body>
JSON WEB SERVICE
• Having the JSON object available as a data format for web services
means that you can create (insert), update, and query any data in
the web service in JSON object format, and get results in the same
format
Questions?
“A good question deserve a good grade…”
Self Check !!
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

Más contenido relacionado

La actualidad más candente

Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5
Michael Girouard
 
webservices overview
webservices overviewwebservices overview
webservices overview
elliando dias
 
RESTful services
RESTful servicesRESTful services
RESTful services
gouthamrv
 

La actualidad más candente (20)

Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5Creating And Consuming Web Services In Php 5
Creating And Consuming Web Services In Php 5
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
 
webservices overview
webservices overviewwebservices overview
webservices overview
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
Excellent rest using asp.net web api
Excellent rest using asp.net web apiExcellent rest using asp.net web api
Excellent rest using asp.net web api
 
Best Practice in API Design
Best Practice in API DesignBest Practice in API Design
Best Practice in API Design
 
SOAP-based Web Services
SOAP-based Web ServicesSOAP-based Web Services
SOAP-based Web Services
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
 
Basic web architecture
Basic web architectureBasic web architecture
Basic web architecture
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 
Building Restful Applications Using Php
Building Restful Applications Using PhpBuilding Restful Applications Using Php
Building Restful Applications Using Php
 
Develop webservice in PHP
Develop webservice in PHPDevelop webservice in PHP
Develop webservice in PHP
 
Web Architecture
Web ArchitectureWeb Architecture
Web Architecture
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
Rest and Rails
Rest and RailsRest and Rails
Rest and Rails
 
Web Services
Web ServicesWeb Services
Web Services
 
The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
Rest in Rails
Rest in RailsRest in Rails
Rest in Rails
 

Similar a Intoduction to php web services and json

Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
kriszyp
 
Programming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E BayProgramming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E Bay
Phi Jack
 
Web Services - A brief overview
Web Services -  A brief overviewWeb Services -  A brief overview
Web Services - A brief overview
Raveendra Bhat
 

Similar a Intoduction to php web services and json (20)

Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
 
08 ajax
08 ajax08 ajax
08 ajax
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
Webservices
WebservicesWebservices
Webservices
 
WEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptxWEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptx
 
Esri Web Applications February11 2011
Esri Web Applications February11 2011Esri Web Applications February11 2011
Esri Web Applications February11 2011
 
Programming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E BayProgramming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E Bay
 
O reilly sacon2018nyc - restful api design - master - v1.0
O reilly sacon2018nyc - restful api design - master - v1.0O reilly sacon2018nyc - restful api design - master - v1.0
O reilly sacon2018nyc - restful api design - master - v1.0
 
Web Programming
Web ProgrammingWeb Programming
Web Programming
 
What is API - Understanding API Simplified
What is API - Understanding API SimplifiedWhat is API - Understanding API Simplified
What is API - Understanding API Simplified
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
Web Browsers.pptx
Web Browsers.pptxWeb Browsers.pptx
Web Browsers.pptx
 
Dojo - from web page to web apps
Dojo - from web page to web appsDojo - from web page to web apps
Dojo - from web page to web apps
 
web programming
web programmingweb programming
web programming
 
Day01 api
Day01   apiDay01   api
Day01 api
 
Web Services
Web ServicesWeb Services
Web Services
 
Using Webservice in iOS
Using Webservice  in iOS Using Webservice  in iOS
Using Webservice in iOS
 
CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHP
 
Web Services - A brief overview
Web Services -  A brief overviewWeb Services -  A brief overview
Web Services - A brief overview
 

Más de baabtra.com - No. 1 supplier of quality freshers

Más de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Último

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Intoduction to php web services and json

  • 2. Website • Response will be in HTML • Accessed by humans via web browsers User browsing websites in HTML Application running on Web server HTTP request HTML response
  • 3. Web Service • A Web service is a method of communications between two software applications over the World Wide Web. • Web services are Accessed by programs/Applications. • Response will be in XML or JSON HTTP/ SOAP / REST request Response in XML / JSON Another application running on Web server Some Application running on a Web server
  • 4. But why I should do so?
  • 5. Consider the Scenario • Suppose you have a travel and tourism application from which users will get updates on flight timings, train timings etc • But for this to be practical- your application must be integrated with the applications of all the airlines(air india, Jet air, King fisher etc) and for the train also which is almost impractical or quire a highly expensive method • So what you do? You go to airlines website, copy the flight times available and enter that data on your travel application, so those details will be available to users of your application !!
  • 6. Application server of emirates airlinesApplication server of your travel application Copy the details from airlines website enter the details of airlines in your travel application
  • 7. Application server of emirates airlinesApplication server of your travel application SOAP/HTTP/REST Webservice User get updates on the flight details from your travel application Using Web service
  • 8. Benefits of Web Service • Exposing the existing function on to network, so that any software's can access • Low Cost of communication • Connecting Different Applications ie Interoperability. This in turns make it possible to access the data exposed by an application(developed in any programming language say .Net) by another application(developed in any other language say android/IOS/PHP etc)
  • 9. Webservices Web service in PHP Other Platforms Windows(c#) Android
  • 10. Web Service Data Format Types • The following standard data format types are supported by Service via the HTTP protocol • SOAP • JSON • CSV • EXCEL • XML • PDF • RSS
  • 11. Web Service Data Format Types • The following standard data format types are supported by Service via the HTTP protocol • SOAP • JSON • CSV • EXCEL • XML • PDF • RSS We will be learning about web services using json as it is the advanced methodology using in the industry
  • 12. JSON
  • 13. JSON • JavaScript Object Notation. • JSON is syntax for storing and exchanging text information. • JSON is language independent. • JSON uses JavaScript syntax for describing data objects. • JSON parsers and JSON libraries exists for many different programming languages.
  • 14. JSON Objects • JSON objects are written inside curly brackets, – Objects can contain multiple name/values pairs: { "firstName":"John" , "lastName":"Doe" } • JSON arrays are written inside square brackets. – An array can contain multiple objects: {"employees": [ { "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstName":"Peter" , "lastName":"Jones" }] }
  • 15. JSON Example <body> <h2>JSON Object Creation in JavaScript</h2> <p> Name : <span id="jname"></span> <br /> Age : <span id="jage"></span> <br /> </p> <script> var JSONObject= {"name":"John Johnson“,"age":33}; document.getElementById("jname").innerHTML=JSONObject.name; document.getElementById("jage").innerHTML=JSONObject.age; </script> </body>
  • 16. JSON WEB SERVICE • Having the JSON object available as a data format for web services means that you can create (insert), update, and query any data in the web service in JSON object format, and get results in the same format
  • 17. Questions? “A good question deserve a good grade…”
  • 19. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 20. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com