SlideShare a Scribd company logo
PHP and Web Services
Bruno Pedro <bpedro@computer.org>
CITOT - May 20th 2007
PHP andWeb Services
Summary
• What is PHP?
• Web Services
• SOAP
• REST
• JSON
• Conclusions
2
PHP andWeb Services
What is PHP?
• PHP: Hypertext Preprocessor
• Open Source Web scripting language
• Created in 1994
• Syntax inherited from C, Java and Perl
• Powerful, yet easy to learn
3
PHP andWeb Services
How is PHP used?
• Content Management
• Forums
• Blogging
• Wiki
• CRM
4
PHP andWeb Services
Who uses PHP?
Source: Zend
5
PHP andWeb Services
Why use PHP?
• Used by 20M+ Web Sites around the globe
• Community-maintained documentation
• Code runs on UNIX, OSX and Windows
• Backed commercially by Zend
• Easy syntax
6
PHP andWeb Services
The PHP language
7
Easy syntax!
PHP andWeb Services
Creating a function
8
function declaration
return value
function call
PHP andWeb Services
Creating a class
9
class declaration
public method
method call
PHP andWeb Services
Web Services
10
Source:The Server Side
(http://tinyurl.com/38umxt)
PHP andWeb Services
What are Web Services?
• Interoperable interactions
• Calls are made over a network
• Lots of different standards
• Popular Web sites use them
11
PHP andWeb Services
Requirements
• PHP 5.2.2
• SOAP
• simplexml
• DOM
• JSON
12
PHP andWeb Services
SOAP
Source: Prentice Hall
(http://tinyurl.com/33dcch)
13
PHP andWeb Services
SOAP
• Simple Object Access Protocol
• Usually an HTTP POST request
• Call is encapsulated in XML
• Response is an XML document
• PHP handles everything
14
PHP andWeb Services
Server implementation
15
namespace
start a server
assign a class
handle incoming calls
PHP andWeb Services
Client implementation
16
namespace
endpoint
display result
PHP andWeb Services
Output
17
namespace
result
PHP andWeb Services
SOAP
18
• Support for SOAP 1.1, 1.2 and WSDL 1.1
• Handles simple and complex types
• Very easy implementation
• Output is quite bulky
PHP andWeb Services
REST
http://example.com/calculator/sum/?x=121&y=233
GET
PUT
POST
DELETE
«interface»
Resource
GET - perform a calculation
PUT - not used
POST - not used
DELETE - not used
/calculator/sum/
19
PHP andWeb Services
REST
• Representational State Transfer
• Usually an HTTP GET request
• Call is made through GET parameters
• Response is an XML document
• Create response with DOM
• Interpret response with simplexml
20
PHP andWeb Services
Server implementation
21
handle incoming call
create an
XML document
add elements
output result
PHP andWeb Services
Client implementation
22
endpoint
arguments
load XML document
output result
PHP andWeb Services
Output
23
result
PHP andWeb Services
REST
24
• Interaction needs to be implemented
• XML schema must be know beforehand
• Complex types not handled natively
• Output is usually RSS
PHP andWeb Services
JSON
25
JSON Logo
Source: json.org
PHP andWeb Services
JSON
• JavaScript Object Notation
• REST approach
• Except response is not XML
• Used on the client side
• Create response with json_encode()
• Interpret response in JavaScript
26
PHP andWeb Services
Server implementation
27
handle incoming call
generate result
output
JSON string
PHP andWeb Services
Client implementation
28
endpoint
arguments
output result
PHP andWeb Services
Output
29
result
PHP andWeb Services
JSON
30
• REST approach
• Handles simple and complex types
• Calls can be made with AJAX
• Can also be used on the server side
PHP andWeb Services
Conclusions
• PHP is a powerful web scripting language
• Too many Web Services standards
• PHP handles all the internals
• REST requires more coding than SOAP
• Use JSON for client side applications
• XML-RPC support is still experimental
31
PHP andWeb Services
Questions?
32
PHP andWeb Services
Resources
33
• My blog: http://unfoldingtheweb.com/
• PHP Manual: http://www.php.net/
• SOAP: http://www.w3.org/TR/soap/
• REST: http://tinyurl.com/akhc7
• JSON: http://www.json.org/

More Related Content

What's hot (9)

PDF
Introduction into PHP5 (Jeroen van Sluijs)
Stefan Koopmanschap
 
PDF
Plone Futures
Eric Steele
 
PDF
PHP MySQL Training : Module 3
hussulinux
 
PDF
RichFaces 4 Component Deep Dive - JAX/JSFSummit
balunasj
 
PDF
Plone server
Ramon Navarro
 
PPTX
Webservices Overview : XML RPC, SOAP and REST
Pradeep Kumar
 
PDF
PHP and Web Services
Bruno Pedro
 
PDF
USP presentation of CHOReOS @ FISL Conference
choreos
 
ODP
Linux Apache Php Mysql Lamp1273
hussulinux
 
Introduction into PHP5 (Jeroen van Sluijs)
Stefan Koopmanschap
 
Plone Futures
Eric Steele
 
PHP MySQL Training : Module 3
hussulinux
 
RichFaces 4 Component Deep Dive - JAX/JSFSummit
balunasj
 
Plone server
Ramon Navarro
 
Webservices Overview : XML RPC, SOAP and REST
Pradeep Kumar
 
PHP and Web Services
Bruno Pedro
 
USP presentation of CHOReOS @ FISL Conference
choreos
 
Linux Apache Php Mysql Lamp1273
hussulinux
 

Viewers also liked (20)

PPTX
Python Code Camp for Professionals 3/4
DEVCON
 
PDF
A python web service
Temian Vlad
 
PDF
Deep-dive into Django #1
Avik Das
 
PDF
Django Introduction & Tutorial
之宇 趙
 
PPTX
Django Mini Tutorial
Fahri Firdausillah
 
PDF
Django Girls / Dutch django meetup feb 2016
Martin Matusiak
 
PPTX
Python Code Camp for Professionals 1/4
DEVCON
 
PDF
Django Templates
Willy Liu
 
PDF
Intro To Mvc Development In Php
funkatron
 
PDF
PHP MVC Tutorial
Yang Bruce
 
PDF
10 - Web-технологии. MVC фреймворки (продолжение)
Roman Brovko
 
ODP
Django for Beginners
Jason Davies
 
PDF
PHP & MVC
Chris Weldon
 
PPT
How to learn to build your own PHP framework
Dinh Pham
 
PPTX
Django - Python MVC Framework
Bala Kumar
 
PDF
Django Best Practices
Abdullah Çetin ÇAVDAR
 
PDF
Python/Django Training
University of Technology
 
KEY
Advanced Django Forms Usage
Daniel Greenfeld
 
PDF
Web Services PHP Tutorial
Lorna Mitchell
 
Python Code Camp for Professionals 3/4
DEVCON
 
A python web service
Temian Vlad
 
Deep-dive into Django #1
Avik Das
 
Django Introduction & Tutorial
之宇 趙
 
Django Mini Tutorial
Fahri Firdausillah
 
Django Girls / Dutch django meetup feb 2016
Martin Matusiak
 
Python Code Camp for Professionals 1/4
DEVCON
 
Django Templates
Willy Liu
 
Intro To Mvc Development In Php
funkatron
 
PHP MVC Tutorial
Yang Bruce
 
10 - Web-технологии. MVC фреймворки (продолжение)
Roman Brovko
 
Django for Beginners
Jason Davies
 
PHP & MVC
Chris Weldon
 
How to learn to build your own PHP framework
Dinh Pham
 
Django - Python MVC Framework
Bala Kumar
 
Django Best Practices
Abdullah Çetin ÇAVDAR
 
Python/Django Training
University of Technology
 
Advanced Django Forms Usage
Daniel Greenfeld
 
Web Services PHP Tutorial
Lorna Mitchell
 
Ad

Similar to Php and webservices (20)

PDF
Php and-web-services-24402
PrinceGuru MS
 
PPT
Php Asp Net Interoperability Rc Jao
jedt
 
PPT
Introduction to web services and how to in php
Amit Kumar Singh
 
PPTX
Day01 api
ABDEL RAHMAN KARIM
 
PDF
Web Services Tutorial
Lorna Mitchell
 
PPT
Webservices
Nyros Technologies
 
PDF
Web services tutorial
Lorna Mitchell
 
PDF
Building Web Services
Jussi Pohjolainen
 
PDF
WSF PHP 2 Webinar Sep 2008
WSO2
 
PDF
PHP Web Development: Empowering the Digital World
company
 
PPTX
Introduction To Web Development & The New Digital Workplace
Jen Wei Lee
 
PDF
How PHP works
Atlogys Technical Consulting
 
PPTX
Php internal architecture
Elizabeth Smith
 
PDF
PHP Web Development.pdf
Fariha Tasnim
 
PDF
PHP Web Development
Sanjida Afrin
 
PPTX
Intoduction to php
shadsaleem
 
PDF
Integrating PHP With System-i using Web Services
Ivo Jansch
 
PDF
PHP And Web Services: Perfect Partners
Lorna Mitchell
 
PDF
PHP is the King, nodejs is the Prince and Lua is the fool
Alessandro Cinelli (cirpo)
 
PDF
Introduction to PHP (SDPHP)
Eric Johnson
 
Php and-web-services-24402
PrinceGuru MS
 
Php Asp Net Interoperability Rc Jao
jedt
 
Introduction to web services and how to in php
Amit Kumar Singh
 
Web Services Tutorial
Lorna Mitchell
 
Webservices
Nyros Technologies
 
Web services tutorial
Lorna Mitchell
 
Building Web Services
Jussi Pohjolainen
 
WSF PHP 2 Webinar Sep 2008
WSO2
 
PHP Web Development: Empowering the Digital World
company
 
Introduction To Web Development & The New Digital Workplace
Jen Wei Lee
 
Php internal architecture
Elizabeth Smith
 
PHP Web Development.pdf
Fariha Tasnim
 
PHP Web Development
Sanjida Afrin
 
Intoduction to php
shadsaleem
 
Integrating PHP With System-i using Web Services
Ivo Jansch
 
PHP And Web Services: Perfect Partners
Lorna Mitchell
 
PHP is the King, nodejs is the Prince and Lua is the fool
Alessandro Cinelli (cirpo)
 
Introduction to PHP (SDPHP)
Eric Johnson
 
Ad

Recently uploaded (20)

PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PDF
AI-Powered-Visual-Storytelling-for-Nonprofits.pdf
TechSoup
 
PDF
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
PPTX
infertility, types,causes, impact, and management
Ritu480198
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PPTX
How to Create a Customer From Website in Odoo 18.pptx
Celine George
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PDF
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
PPTX
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
PDF
Council of Chalcedon Re-Examined
Smiling Lungs
 
PDF
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
AI-Powered-Visual-Storytelling-for-Nonprofits.pdf
TechSoup
 
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
infertility, types,causes, impact, and management
Ritu480198
 
Introduction presentation of the patentbutler tool
MIPLM
 
How to Create a Customer From Website in Odoo 18.pptx
Celine George
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Horarios de distribución de agua en julio
pegazohn1978
 
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
Council of Chalcedon Re-Examined
Smiling Lungs
 
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 

Php and webservices