SlideShare a Scribd company logo
1 of 33
Download to read offline
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)

01 Php Introduction
01 Php Introduction01 Php Introduction
01 Php Introduction
 
Presentation php
Presentation phpPresentation php
Presentation php
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Overview of PHP and MYSQL
Overview of PHP and MYSQLOverview of PHP and MYSQL
Overview of PHP and MYSQL
 
Top 100 PHP Questions and Answers
Top 100 PHP Questions and AnswersTop 100 PHP Questions and Answers
Top 100 PHP Questions and Answers
 
Php Ppt
Php PptPhp Ppt
Php Ppt
 
Php(report)
Php(report)Php(report)
Php(report)
 
Loops PHP 04
Loops PHP 04Loops PHP 04
Loops PHP 04
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Php hypertext pre-processor
Php   hypertext pre-processorPhp   hypertext pre-processor
Php hypertext pre-processor
 
Php Unit 1
Php Unit 1Php Unit 1
Php Unit 1
 
php
phpphp
php
 
PHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERSPHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERS
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
Chapter 02 php basic syntax
Chapter 02   php basic syntaxChapter 02   php basic syntax
Chapter 02 php basic syntax
 
Php presentation
Php presentationPhp presentation
Php presentation
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Php simple
Php simplePhp simple
Php simple
 

Viewers also liked

Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8PrinceGuru MS
 
Php tips-and-tricks4128
Php tips-and-tricks4128Php tips-and-tricks4128
Php tips-and-tricks4128PrinceGuru MS
 
SQL practice questions - set 3
SQL practice questions - set 3SQL practice questions - set 3
SQL practice questions - set 3Mohd Tousif
 
Phpworks enterprise-php-1227605806710884-9
Phpworks enterprise-php-1227605806710884-9Phpworks enterprise-php-1227605806710884-9
Phpworks enterprise-php-1227605806710884-9PrinceGuru MS
 

Viewers also liked (9)

Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8
 
Php tips-and-tricks4128
Php tips-and-tricks4128Php tips-and-tricks4128
Php tips-and-tricks4128
 
SQL practice questions - set 3
SQL practice questions - set 3SQL practice questions - set 3
SQL practice questions - set 3
 
Php security3895
Php security3895Php security3895
Php security3895
 
Php tizag tutorial
Php tizag tutorialPhp tizag tutorial
Php tizag tutorial
 
Deadlock
DeadlockDeadlock
Deadlock
 
Phpworks enterprise-php-1227605806710884-9
Phpworks enterprise-php-1227605806710884-9Phpworks enterprise-php-1227605806710884-9
Phpworks enterprise-php-1227605806710884-9
 
Firstcup
FirstcupFirstcup
Firstcup
 
Unidad2
Unidad2Unidad2
Unidad2
 

Similar to Php and-web-services-24402

Php and webservices
Php and webservicesPhp and webservices
Php and webservicesmcanotes
 
PHP and Web Services
PHP and Web ServicesPHP and Web Services
PHP and Web ServicesBruno Pedro
 
Php And Web Services
Php And Web ServicesPhp And Web Services
Php And Web Servicesthinkphp
 
Introduction to Server-Side Development with PHP.ppt
Introduction to Server-Side Development with PHP.pptIntroduction to Server-Side Development with PHP.ppt
Introduction to Server-Side Development with PHP.pptDestaBelayneh1
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptnohuhu
 
PHP Web Development Frameworks & Advantages
PHP Web Development Frameworks & AdvantagesPHP Web Development Frameworks & Advantages
PHP Web Development Frameworks & AdvantagesAditMicrosys Australia
 
Integrating PHP With System-i using Web Services
Integrating PHP With System-i using Web ServicesIntegrating PHP With System-i using Web Services
Integrating PHP With System-i using Web ServicesIvo Jansch
 
PHP and the Cloud: The view from the bazaar
PHP and the Cloud: The view from the bazaarPHP and the Cloud: The view from the bazaar
PHP and the Cloud: The view from the bazaarvitoc
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service DesignLorna Mitchell
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftRX-M Enterprises LLC
 
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発Atsushi Matsuo
 
RESTful web
RESTful webRESTful web
RESTful webAlvin Qi
 
DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)dpc
 
USP presentation of CHOReOS @ FISL Conference
USP presentation of CHOReOS @ FISL ConferenceUSP presentation of CHOReOS @ FISL Conference
USP presentation of CHOReOS @ FISL Conferencechoreos
 
Adding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsAdding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsRonny López
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantarIndicThreads
 

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

Php and webservices
Php and webservicesPhp and webservices
Php and webservices
 
PHP and Web Services
PHP and Web ServicesPHP and Web Services
PHP and Web Services
 
Php And Web Services
Php And Web ServicesPhp And Web Services
Php And Web Services
 
Introduction to Server-Side Development with PHP.ppt
Introduction to Server-Side Development with PHP.pptIntroduction to Server-Side Development with PHP.ppt
Introduction to Server-Side Development with PHP.ppt
 
Understanding Web services
Understanding Web servicesUnderstanding Web services
Understanding Web services
 
Building Web Services
Building Web ServicesBuilding Web Services
Building Web Services
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScript
 
PHP Web Development Frameworks & Advantages
PHP Web Development Frameworks & AdvantagesPHP Web Development Frameworks & Advantages
PHP Web Development Frameworks & Advantages
 
Integrating PHP With System-i using Web Services
Integrating PHP With System-i using Web ServicesIntegrating PHP With System-i using Web Services
Integrating PHP With System-i using Web Services
 
PHP and the Cloud: The view from the bazaar
PHP and the Cloud: The view from the bazaarPHP and the Cloud: The view from the bazaar
PHP and the Cloud: The view from the bazaar
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service Design
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
 
Datasnap
DatasnapDatasnap
Datasnap
 
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
Webアプリケーションフレームワークを利用した効率的なカスタムWeb開発
 
PHP at Yahoo!
PHP at Yahoo!PHP at Yahoo!
PHP at Yahoo!
 
RESTful web
RESTful webRESTful web
RESTful web
 
DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)
 
USP presentation of CHOReOS @ FISL Conference
USP presentation of CHOReOS @ FISL ConferenceUSP presentation of CHOReOS @ FISL Conference
USP presentation of CHOReOS @ FISL Conference
 
Adding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsAdding Real-time Features to PHP Applications
Adding Real-time Features to PHP Applications
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantar
 

More from PrinceGuru MS

Phpjedi 090307090434-phpapp01 2
Phpjedi 090307090434-phpapp01 2Phpjedi 090307090434-phpapp01 2
Phpjedi 090307090434-phpapp01 2PrinceGuru MS
 
Php tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPrinceGuru MS
 
Codeigniter 1.7.1 helper_reference
Codeigniter 1.7.1 helper_referenceCodeigniter 1.7.1 helper_reference
Codeigniter 1.7.1 helper_referencePrinceGuru MS
 
Cake php 1.2-cheatsheet
Cake php 1.2-cheatsheetCake php 1.2-cheatsheet
Cake php 1.2-cheatsheetPrinceGuru MS
 

More from PrinceGuru MS (6)

Phpjedi 090307090434-phpapp01 2
Phpjedi 090307090434-phpapp01 2Phpjedi 090307090434-phpapp01 2
Phpjedi 090307090434-phpapp01 2
 
Php tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_master
 
Drupal refcard
Drupal refcardDrupal refcard
Drupal refcard
 
Codeigniter 1.7.1 helper_reference
Codeigniter 1.7.1 helper_referenceCodeigniter 1.7.1 helper_reference
Codeigniter 1.7.1 helper_reference
 
Class2011
Class2011Class2011
Class2011
 
Cake php 1.2-cheatsheet
Cake php 1.2-cheatsheetCake php 1.2-cheatsheet
Cake php 1.2-cheatsheet
 

Recently uploaded

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
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 RobisonAnna Loughnan Colquhoun
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
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 educationjfdjdjcjdnsjd
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
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 Scriptwesley chun
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
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 WorkerThousandEyes
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Recently uploaded (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Php and-web-services-24402

  • 1. PHP and Web Services CITOT - May 20th 2007 Bruno Pedro <bpedro@computer.org>
  • 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