SlideShare a Scribd company logo
PHP and Web Services
      CITOT - May    20th   2007
   Bruno Pedro <bpedro@computer.org>
Summary
 • What is PHP?
 • Web Services
  • SOAP
  • REST
  • JSON
 • Conclusions
PHP and Web Services      2
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
PHP and Web Services    3
How is PHP used?

  • Content Management
  • Forums
  • Blogging
  • Wiki
  • CRM
PHP and Web Services   4
Who uses PHP?




                              Source: Zend



PHP and Web Services   5
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
PHP and Web Services   6
The PHP language


                           Easy syntax!




PHP and Web Services   7
Creating a function
                           function declaration


                            return value


                            function call




PHP and Web Services   8
Creating a class
                           class declaration


                           public method




                            method call


PHP and Web Services   9
Web Services




                                  Source:The Server Side
                              (http://tinyurl.com/38umxt)

PHP and Web Services    10
What are Web Services?

  • Interoperable interactions
  • Calls are made over a network
  • Lots of different standards
  • Popular Web sites use them

PHP and Web Services   11
Requirements

  • PHP 5.2.2
  • SOAP
  • simplexml
  • DOM
  • JSON
PHP and Web Services   12
SOAP




                                     Source: Prentice Hall
                              (http://tinyurl.com/33dcch)


PHP and Web Services    13
SOAP

  • Simple Object Access Protocol
  • Usually an HTTP POST request
  • Call is encapsulated in XML
  • Response is an XML document
  • PHP handles everything
PHP and Web Services    14
Server implementation

                                               namespace




                                               start a server
                                        assign a class
                            handle incoming calls

PHP and Web Services   15
Client implementation
                                namespace




                                   endpoint



          display result

PHP and Web Services       16
Output
                                   namespace




                          result

PHP and Web Services     17
SOAP

  • Support for SOAP 1.1, 1.2 and WSDL 1.1
  • Handles simple and complex types
  • Very easy implementation
  • Output is quite bulky

PHP and Web Services    18
REST
      «interface»
                                    /calculator/sum/
       Resource
                               GET - perform a calculation
     GET
                               PUT - not used
     PUT
                               POST - not used
     POST
                               DELETE - not used
     DELETE




    http://example.com/calculator/sum/?x=121&y=233




PHP and Web Services      19
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
PHP and Web Services    20
Server implementation
                                handle incoming call



                                      create an
                                      XML document

                                             add elements

                            output result

PHP and Web Services   21
Client implementation

                                        endpoint

                                     arguments



                                 load XML document

            output result

PHP and Web Services        22
Output



                              result




PHP and Web Services     23
REST

  • Interaction needs to be implemented
  • XML schema must be know beforehand
  • Complex types not handled natively
  • Output is usually RSS

PHP and Web Services    24
JSON




                                 JSON Logo
                             Source: json.org




PHP and Web Services    25
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
PHP and Web Services    26
Server implementation

                            handle incoming call



                                         generate result


                                          output
                                          JSON string

PHP and Web Services   27
Client implementation
                                            endpoint



                                                       arguments




                       output result


PHP and Web Services                   28
Output



                              result




PHP and Web Services     29
JSON

  • REST approach
  • Handles simple and complex types
  • Calls can be made with AJAX
  • Can also be used on the server side

PHP and Web Services    30
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
PHP and Web Services        31
Questions?




PHP and Web Services       32
Resources
  • 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/
PHP and Web Services       33

More Related Content

What's hot (20)

PPT
01 Php Introduction
Geshan Manandhar
 
PPTX
Presentation php
Muhammad Saqib Malik
 
PPT
Introduction to php
Meetendra Singh
 
PDF
Introduction to php
Anjan Banda
 
PPT
Overview of PHP and MYSQL
Deblina Chowdhury
 
PDF
Top 100 PHP Questions and Answers
iimjobs and hirist
 
PPT
Php Ppt
vsnmurthy
 
PPT
Php(report)
Yhannah
 
PPTX
Loops PHP 04
mohamedsaad24
 
PPTX
Introduction to php
Taha Malampatti
 
PDF
Php tutorial
Niit
 
PPT
Php hypertext pre-processor
Siddique Ibrahim
 
PPTX
Php Unit 1
team11vgnt
 
DOCX
PHP NOTES FOR BEGGINERS
Aminiel Michael
 
PDF
Php tutorial(w3schools)
Arjun Shanka
 
PPT
Chapter 02 php basic syntax
Dhani Ahmad
 
PPTX
Php presentation
Helen Pitlick
 
PPT
Php mysql
Shehrevar Davierwala
 
PDF
Php simple
PrinceGuru MS
 
01 Php Introduction
Geshan Manandhar
 
Presentation php
Muhammad Saqib Malik
 
Introduction to php
Meetendra Singh
 
Introduction to php
Anjan Banda
 
Overview of PHP and MYSQL
Deblina Chowdhury
 
Top 100 PHP Questions and Answers
iimjobs and hirist
 
Php Ppt
vsnmurthy
 
Php(report)
Yhannah
 
Loops PHP 04
mohamedsaad24
 
Introduction to php
Taha Malampatti
 
Php tutorial
Niit
 
Php hypertext pre-processor
Siddique Ibrahim
 
Php Unit 1
team11vgnt
 
PHP NOTES FOR BEGGINERS
Aminiel Michael
 
Php tutorial(w3schools)
Arjun Shanka
 
Chapter 02 php basic syntax
Dhani Ahmad
 
Php presentation
Helen Pitlick
 
Php simple
PrinceGuru MS
 

Viewers also liked (9)

PPT
Corephpcomponentpresentation 1211425966721657-8
PrinceGuru MS
 
PDF
Php tips-and-tricks4128
PrinceGuru MS
 
DOC
SQL practice questions - set 3
Mohd Tousif
 
PPS
Php security3895
PrinceGuru MS
 
PDF
Php tizag tutorial
PrinceGuru MS
 
PDF
Deadlock
Mohd Tousif
 
PDF
Phpworks enterprise-php-1227605806710884-9
PrinceGuru MS
 
PDF
Firstcup
PrinceGuru MS
 
PDF
Unidad2
Summum7777
 
Corephpcomponentpresentation 1211425966721657-8
PrinceGuru MS
 
Php tips-and-tricks4128
PrinceGuru MS
 
SQL practice questions - set 3
Mohd Tousif
 
Php security3895
PrinceGuru MS
 
Php tizag tutorial
PrinceGuru MS
 
Deadlock
Mohd Tousif
 
Phpworks enterprise-php-1227605806710884-9
PrinceGuru MS
 
Firstcup
PrinceGuru MS
 
Unidad2
Summum7777
 
Ad

Similar to Php and-web-services-24402 (20)

PDF
Php And Web Services
thinkphp
 
PDF
PHP and Web Services
Bruno Pedro
 
PDF
Php and webservices
mcanotes
 
PDF
Web Services Tutorial
Lorna Mitchell
 
PDF
Web Services PHP Tutorial
Lorna Mitchell
 
PDF
Web services tutorial
Lorna Mitchell
 
PPTX
Day01 api
ABDEL RAHMAN KARIM
 
PDF
PHP And Web Services: Perfect Partners
Lorna Mitchell
 
PPT
Webservices
Nyros Technologies
 
PDF
Consuming RESTful services in PHP
Zoran Jeremic
 
PDF
Consuming RESTful Web services in PHP
Zoran Jeremic
 
PDF
Building Web Services
Jussi Pohjolainen
 
PDF
Working with web_services
Lorna Mitchell
 
PDF
PHP Web Development.pdf
Fariha Tasnim
 
PDF
Integrating PHP With System-i using Web Services
Ivo Jansch
 
PPTX
Web services soap and rest by mandakini for TechGig
Mandakini Kumari
 
PDF
Best Practices in Web Service Design
Lorna Mitchell
 
PPTX
Introduction To Web Development & The New Digital Workplace
Jen Wei Lee
 
PDF
WSF PHP 2 Webinar Sep 2008
WSO2
 
PDF
Taking Care of The REST - Creating your own RESTful API Server using Restler 2.0
Arul Kumaran
 
Php And Web Services
thinkphp
 
PHP and Web Services
Bruno Pedro
 
Php and webservices
mcanotes
 
Web Services Tutorial
Lorna Mitchell
 
Web Services PHP Tutorial
Lorna Mitchell
 
Web services tutorial
Lorna Mitchell
 
PHP And Web Services: Perfect Partners
Lorna Mitchell
 
Webservices
Nyros Technologies
 
Consuming RESTful services in PHP
Zoran Jeremic
 
Consuming RESTful Web services in PHP
Zoran Jeremic
 
Building Web Services
Jussi Pohjolainen
 
Working with web_services
Lorna Mitchell
 
PHP Web Development.pdf
Fariha Tasnim
 
Integrating PHP With System-i using Web Services
Ivo Jansch
 
Web services soap and rest by mandakini for TechGig
Mandakini Kumari
 
Best Practices in Web Service Design
Lorna Mitchell
 
Introduction To Web Development & The New Digital Workplace
Jen Wei Lee
 
WSF PHP 2 Webinar Sep 2008
WSO2
 
Taking Care of The REST - Creating your own RESTful API Server using Restler 2.0
Arul Kumaran
 
Ad

More from PrinceGuru MS (6)

PDF
Phpjedi 090307090434-phpapp01 2
PrinceGuru MS
 
PDF
Php tutorial from_beginner_to_master
PrinceGuru MS
 
PDF
Drupal refcard
PrinceGuru MS
 
PDF
Codeigniter 1.7.1 helper_reference
PrinceGuru MS
 
PDF
Class2011
PrinceGuru MS
 
PDF
Cake php 1.2-cheatsheet
PrinceGuru MS
 
Phpjedi 090307090434-phpapp01 2
PrinceGuru MS
 
Php tutorial from_beginner_to_master
PrinceGuru MS
 
Drupal refcard
PrinceGuru MS
 
Codeigniter 1.7.1 helper_reference
PrinceGuru MS
 
Class2011
PrinceGuru MS
 
Cake php 1.2-cheatsheet
PrinceGuru MS
 

Recently uploaded (20)

PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 

Php and-web-services-24402

  • 1. PHP and Web Services CITOT - May 20th 2007 Bruno Pedro <[email protected]>
  • 2. Summary • What is PHP? • Web Services • SOAP • REST • JSON • Conclusions PHP and Web Services 2
  • 3. 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 PHP and Web Services 3
  • 4. How is PHP used? • Content Management • Forums • Blogging • Wiki • CRM PHP and Web Services 4
  • 5. Who uses PHP? Source: Zend PHP and Web Services 5
  • 6. 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 PHP and Web Services 6
  • 7. The PHP language Easy syntax! PHP and Web Services 7
  • 8. Creating a function function declaration return value function call PHP and Web Services 8
  • 9. Creating a class class declaration public method method call PHP and Web Services 9
  • 10. Web Services Source:The Server Side (http://tinyurl.com/38umxt) PHP and Web Services 10
  • 11. What are Web Services? • Interoperable interactions • Calls are made over a network • Lots of different standards • Popular Web sites use them PHP and Web Services 11
  • 12. Requirements • PHP 5.2.2 • SOAP • simplexml • DOM • JSON PHP and Web Services 12
  • 13. SOAP Source: Prentice Hall (http://tinyurl.com/33dcch) PHP and Web Services 13
  • 14. SOAP • Simple Object Access Protocol • Usually an HTTP POST request • Call is encapsulated in XML • Response is an XML document • PHP handles everything PHP and Web Services 14
  • 15. Server implementation namespace start a server assign a class handle incoming calls PHP and Web Services 15
  • 16. Client implementation namespace endpoint display result PHP and Web Services 16
  • 17. Output namespace result PHP and Web Services 17
  • 18. SOAP • Support for SOAP 1.1, 1.2 and WSDL 1.1 • Handles simple and complex types • Very easy implementation • Output is quite bulky PHP and Web Services 18
  • 19. REST «interface» /calculator/sum/ Resource GET - perform a calculation GET PUT - not used PUT POST - not used POST DELETE - not used DELETE http://example.com/calculator/sum/?x=121&y=233 PHP and Web Services 19
  • 20. 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 PHP and Web Services 20
  • 21. Server implementation handle incoming call create an XML document add elements output result PHP and Web Services 21
  • 22. Client implementation endpoint arguments load XML document output result PHP and Web Services 22
  • 23. Output result PHP and Web Services 23
  • 24. REST • Interaction needs to be implemented • XML schema must be know beforehand • Complex types not handled natively • Output is usually RSS PHP and Web Services 24
  • 25. JSON JSON Logo Source: json.org PHP and Web Services 25
  • 26. 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 PHP and Web Services 26
  • 27. Server implementation handle incoming call generate result output JSON string PHP and Web Services 27
  • 28. Client implementation endpoint arguments output result PHP and Web Services 28
  • 29. Output result PHP and Web Services 29
  • 30. JSON • REST approach • Handles simple and complex types • Calls can be made with AJAX • Can also be used on the server side PHP and Web Services 30
  • 31. 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 PHP and Web Services 31
  • 32. Questions? PHP and Web Services 32
  • 33. Resources • 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/ PHP and Web Services 33