SlideShare una empresa de Scribd logo
1 de 4
Akshara Dave Page 1
SVIIT
Sending mail using PHP
PHP allows you to send e-mails directly from a script using mail() function.
Syntax:
Mail (to, subject, message, headers, parameters)
Parameter Description
To Required. Specifies the receiver/receivers of the email
subject Required. Specifies the subject of the email. Note: This parameter
cannot contain any newline characters
message Required. Defines the message to be sent. Each line should be
separated with a LF (n). Lines should not exceed 70 characters
headers Optional. Specifies additional headers, like From, Cc, and Bcc. The
additional headers should be separated with a CRLF (rn)
parameters Optional. Specifies an additional parameter to the sendmail program
Send a simple mail:
<?php
$to = "abc@yahoo.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = ”xyz@gmail.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
PHP Mail form:
With PHP, you can create a feedback-form on your website. The example below sends a text message
to a specified e-mail address:
<html>
<body>
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("someone@example.com", $subject,
$message, "From:" . $email);
echo "Thank you for using our mail form";
}
else
Akshara Dave Page 2
SVIIT
//if "email" is not filled out, display the form
{
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text'><br>
Subject: <input name='subject' type='text'><br>
Message:<br>
<textarea name='message' rows='15' cols='40'>
</textarea><br>
<input type='submit'>
</form>";
}
?>
</body>
</html>
This is how the example above works:
 First, check if the email input field is filled out
 If it is not set (like when the page is first visited); output the HTML form
 If it is set (after the form is filled out); send the email from the form
 When submit is pressed after the form is filled out, the page reloads, sees that the email input
is set, and sends the email
Akshara Dave Page 3
SVIIT
Web Services:
A “web service” is a network accessible interface to application functionality built using XML and
usually HTTP.
Three forms of Web services:
 SOAP
 XML-RPC
 REST
SOAP
 Formerly known as Simple Object Access Protocol
 Uses XML, but it is not needed
 One just call functions and manipulate arrays.
 A few PHP implementations: PEAR::SOAP, PHP-SOAP, NuSOAP
 SOAP is most complicated and has interoperability problems but large vendors such as
Microsoft, and IBM have thrown support behind it.
XML-RPC
 XML is Remote procedural Call
 Advantage: Similar to SOAP but less complex
 Disadvantage: SOAP has better buzzword compliance
 XML-RPC offers a nice blend of power and simplicity but lacks big vendor support.
REST
 Representational State Transfer(Roy fielding)
 Make URI request using existing HTTP methods: GET/ POST/ PUT/ DELETE
 Data returned as XML and not needed.
 Many ways to parse XML: SAX/ DOM/ XSLT/ SimpleXML
 REST is most lightweight and easy to use but offers the least functionality
REST vs. SOAP
Both REST and SOAP is widely adopted techniques for building distributed systems. REST is an
architectural style for implementing systems on top of HTTP infrastructure. A large number of
specifications have been developed on top of SOAP and there are large number of SOAP stacks both
open source and proprietary out there implementing large part of stack
Both these techniques have their advantages and drawbacks. Here are few of the advantages and
disadvantages of each paradigm.
Akshara Dave Page 4
SVIIT
REST advantage:
 Based on few simple principles which are already in wide adoption on the web itself
 Can be implemented very quickely
 Ideal for providing simple API’s to the users.(E.G. whether services, flicker, yahoo REST
services)
 Amount of learning required to get started is minimum in comparison to SOAP
 Has a very large following amount the scripting community
REST Disadvantage:
 IF the system is a very large one, then designing based on REST could become a very complex
task
 Implementing security on a REST system is one major issue. Although HTTPS, and HTTP
authentication can be used, they only provide transport level security.
SOAP advantage:
 Well designed
 Has been widely adopted in industry
 Large number of SOAP stacks available to choose from.
 Has support for both transport level and message level security which is a big advantage over
REST
 Supports multiple protocol binding (not just HTTP)
 Ideal for implementing complex enterprise systems since the SOAP stacks cater for security,
reliability, transactions etc.
SOAP Disadvantage:
 Complex in comparison to REST
 Big learning curve required
 Difficult to debug a complex system
One great thing about using WSF/ PHP is that it can support both of these techniques simultaneously.
Reasons to use Web services:
Web services operate on a service based model architecture. This the most compelling reason why we
use web services.
Second reason for using is that web services allow us to communicate among all different entities
without affecting their existence.
This forms the third reason for using a web service is that it is written separately from the application
logic.
The fourth reason why we use web service is that they improve the information flow between
applications.
The fifth reason why we use web service is that, web services, use text based protocol that all
applications can understand.

Más contenido relacionado

La actualidad más candente

E mail transfer .74
E mail transfer .74E mail transfer .74
E mail transfer .74
myrajendra
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
Rajan Pandey
 
Information on protocols-email protocols
Information on protocols-email protocolsInformation on protocols-email protocols
Information on protocols-email protocols
Priyanka Shinde
 
Simple Object Access Protocol
Simple Object Access ProtocolSimple Object Access Protocol
Simple Object Access Protocol
Saatviga Sudhahar
 
Simple object access protocol
Simple object access protocolSimple object access protocol
Simple object access protocol
djleis
 

La actualidad más candente (19)

E mail transfer .74
E mail transfer .74E mail transfer .74
E mail transfer .74
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
 
Introduction to SOAP
Introduction to SOAPIntroduction to SOAP
Introduction to SOAP
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
 
SMTP - SIMPLE MAIL TRANSFER PROTOCOL
SMTP - SIMPLE MAIL TRANSFER PROTOCOLSMTP - SIMPLE MAIL TRANSFER PROTOCOL
SMTP - SIMPLE MAIL TRANSFER PROTOCOL
 
Information on protocols-email protocols
Information on protocols-email protocolsInformation on protocols-email protocols
Information on protocols-email protocols
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
 
Simple Object Access Protocol
Simple Object Access ProtocolSimple Object Access Protocol
Simple Object Access Protocol
 
Sending Email
Sending EmailSending Email
Sending Email
 
Smtp, pop3, imapv 4
Smtp, pop3, imapv 4Smtp, pop3, imapv 4
Smtp, pop3, imapv 4
 
Email server system1.ppt
Email server system1.pptEmail server system1.ppt
Email server system1.ppt
 
POP (Post Office Protocol )
POP (Post Office Protocol )POP (Post Office Protocol )
POP (Post Office Protocol )
 
SNMP/SMTP/MIME
SNMP/SMTP/MIMESNMP/SMTP/MIME
SNMP/SMTP/MIME
 
connectivity utility
connectivity utilityconnectivity utility
connectivity utility
 
Simple object access protocol
Simple object access protocolSimple object access protocol
Simple object access protocol
 
Lecture 9 electronic_mail_representation_and_transfer
Lecture 9 electronic_mail_representation_and_transferLecture 9 electronic_mail_representation_and_transfer
Lecture 9 electronic_mail_representation_and_transfer
 
Smtp
SmtpSmtp
Smtp
 
Lecture19
Lecture19Lecture19
Lecture19
 
Electronic mail
Electronic mailElectronic mail
Electronic mail
 

Destacado

Php safe-code
Php safe-codePhp safe-code
Php safe-code
wysyw
 
Dynamic Web Pages Ch 2 V1.0
Dynamic Web Pages Ch 2 V1.0Dynamic Web Pages Ch 2 V1.0
Dynamic Web Pages Ch 2 V1.0
Cathie101
 
Osi model mod2 xxx
Osi model mod2 xxxOsi model mod2 xxx
Osi model mod2 xxx
sako555
 

Destacado (17)

Php safe-code
Php safe-codePhp safe-code
Php safe-code
 
Dynamic Web Pages Ch 2 V1.0
Dynamic Web Pages Ch 2 V1.0Dynamic Web Pages Ch 2 V1.0
Dynamic Web Pages Ch 2 V1.0
 
Another one on Email...
Another one on Email...Another one on Email...
Another one on Email...
 
Making web forms using php
Making web forms using phpMaking web forms using php
Making web forms using php
 
PHP and MySQL : Server Side Scripting For Web Development
PHP and MySQL : Server Side Scripting For Web DevelopmentPHP and MySQL : Server Side Scripting For Web Development
PHP and MySQL : Server Side Scripting For Web Development
 
Osi model mod2 xxx
Osi model mod2 xxxOsi model mod2 xxx
Osi model mod2 xxx
 
OSI Layers
OSI LayersOSI Layers
OSI Layers
 
Managing Emails using MS Office Outlook
Managing Emails using MS Office Outlook Managing Emails using MS Office Outlook
Managing Emails using MS Office Outlook
 
19680918_doc(3)
19680918_doc(3)19680918_doc(3)
19680918_doc(3)
 
Delosjuiciosejecutivos
DelosjuiciosejecutivosDelosjuiciosejecutivos
Delosjuiciosejecutivos
 
SPELKORT INSÖK
SPELKORT INSÖKSPELKORT INSÖK
SPELKORT INSÖK
 
Arlene james -_preludio_de_amor
Arlene james -_preludio_de_amorArlene james -_preludio_de_amor
Arlene james -_preludio_de_amor
 
Colorbass
ColorbassColorbass
Colorbass
 
Sesion 5-criterios-de-diseño
Sesion 5-criterios-de-diseñoSesion 5-criterios-de-diseño
Sesion 5-criterios-de-diseño
 
La empresa. Amanda Reyes
La empresa. Amanda ReyesLa empresa. Amanda Reyes
La empresa. Amanda Reyes
 
La mise en œuvre du FBR au Burkina Faso: l’exemple du district sanitaire de ...
 La mise en œuvre du FBR au Burkina Faso: l’exemple du district sanitaire de ... La mise en œuvre du FBR au Burkina Faso: l’exemple du district sanitaire de ...
La mise en œuvre du FBR au Burkina Faso: l’exemple du district sanitaire de ...
 
Sinclair Week 9
Sinclair Week 9Sinclair Week 9
Sinclair Week 9
 

Similar a Sending mail,web services

Intro to web services
Intro to web servicesIntro to web services
Intro to web services
Neil Ghosh
 
Xml web services
Xml web servicesXml web services
Xml web services
Raghu nath
 
Rest vs soap
Rest vs soapRest vs soap
Rest vs soap
Naseers
 

Similar a Sending mail,web services (20)

Intro to web services
Intro to web servicesIntro to web services
Intro to web services
 
Web Programming
Web ProgrammingWeb Programming
Web Programming
 
Web Service
Web ServiceWeb Service
Web Service
 
Api 101
Api 101Api 101
Api 101
 
SOAP--Simple Object Access Protocol
SOAP--Simple Object Access ProtocolSOAP--Simple Object Access Protocol
SOAP--Simple Object Access Protocol
 
Rest web service
Rest web serviceRest web service
Rest web service
 
Xml web services
Xml web servicesXml web services
Xml web services
 
Web services Concepts
Web services ConceptsWeb services Concepts
Web services Concepts
 
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
 
IRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce Site
 
53 hui homework2
53 hui homework253 hui homework2
53 hui homework2
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 
web programming
web programmingweb programming
web programming
 
SOAP WEB TECHNOLOGIES
SOAP WEB TECHNOLOGIESSOAP WEB TECHNOLOGIES
SOAP WEB TECHNOLOGIES
 
soap toolkit
soap toolkitsoap toolkit
soap toolkit
 
Rest vs soap
Rest vs soapRest vs soap
Rest vs soap
 
SOA and web services
SOA and web servicesSOA and web services
SOA and web services
 
jkljklj
jkljkljjkljklj
jkljklj
 
C# ASP.NET WEB API APPLICATION DEVELOPMENT
C# ASP.NET WEB API APPLICATION DEVELOPMENTC# ASP.NET WEB API APPLICATION DEVELOPMENT
C# ASP.NET WEB API APPLICATION DEVELOPMENT
 
WIT UNIT-5.pdf
WIT UNIT-5.pdfWIT UNIT-5.pdf
WIT UNIT-5.pdf
 

Último

Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
amitlee9823
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Anamikakaur10
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Russian Call Girls In Rajiv Chowk Gurgaon ❤️8448577510 ⊹Best Escorts Service ...
Russian Call Girls In Rajiv Chowk Gurgaon ❤️8448577510 ⊹Best Escorts Service ...Russian Call Girls In Rajiv Chowk Gurgaon ❤️8448577510 ⊹Best Escorts Service ...
Russian Call Girls In Rajiv Chowk Gurgaon ❤️8448577510 ⊹Best Escorts Service ...
lizamodels9
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Sheetaleventcompany
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
dollysharma2066
 
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂EscortCall Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
dlhescort
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
amitlee9823
 

Último (20)

How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture concept
 
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceEluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
 
PHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation FinalPHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation Final
 
Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Value Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsValue Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and pains
 
Russian Call Girls In Rajiv Chowk Gurgaon ❤️8448577510 ⊹Best Escorts Service ...
Russian Call Girls In Rajiv Chowk Gurgaon ❤️8448577510 ⊹Best Escorts Service ...Russian Call Girls In Rajiv Chowk Gurgaon ❤️8448577510 ⊹Best Escorts Service ...
Russian Call Girls In Rajiv Chowk Gurgaon ❤️8448577510 ⊹Best Escorts Service ...
 
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 MonthsSEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
 
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in indiaFalcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in india
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
 
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂EscortCall Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
 
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
 

Sending mail,web services

  • 1. Akshara Dave Page 1 SVIIT Sending mail using PHP PHP allows you to send e-mails directly from a script using mail() function. Syntax: Mail (to, subject, message, headers, parameters) Parameter Description To Required. Specifies the receiver/receivers of the email subject Required. Specifies the subject of the email. Note: This parameter cannot contain any newline characters message Required. Defines the message to be sent. Each line should be separated with a LF (n). Lines should not exceed 70 characters headers Optional. Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (rn) parameters Optional. Specifies an additional parameter to the sendmail program Send a simple mail: <?php $to = "abc@yahoo.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = ”xyz@gmail.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> PHP Mail form: With PHP, you can create a feedback-form on your website. The example below sends a text message to a specified e-mail address: <html> <body> <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("someone@example.com", $subject, $message, "From:" . $email); echo "Thank you for using our mail form"; } else
  • 2. Akshara Dave Page 2 SVIIT //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text'><br> Subject: <input name='subject' type='text'><br> Message:<br> <textarea name='message' rows='15' cols='40'> </textarea><br> <input type='submit'> </form>"; } ?> </body> </html> This is how the example above works:  First, check if the email input field is filled out  If it is not set (like when the page is first visited); output the HTML form  If it is set (after the form is filled out); send the email from the form  When submit is pressed after the form is filled out, the page reloads, sees that the email input is set, and sends the email
  • 3. Akshara Dave Page 3 SVIIT Web Services: A “web service” is a network accessible interface to application functionality built using XML and usually HTTP. Three forms of Web services:  SOAP  XML-RPC  REST SOAP  Formerly known as Simple Object Access Protocol  Uses XML, but it is not needed  One just call functions and manipulate arrays.  A few PHP implementations: PEAR::SOAP, PHP-SOAP, NuSOAP  SOAP is most complicated and has interoperability problems but large vendors such as Microsoft, and IBM have thrown support behind it. XML-RPC  XML is Remote procedural Call  Advantage: Similar to SOAP but less complex  Disadvantage: SOAP has better buzzword compliance  XML-RPC offers a nice blend of power and simplicity but lacks big vendor support. REST  Representational State Transfer(Roy fielding)  Make URI request using existing HTTP methods: GET/ POST/ PUT/ DELETE  Data returned as XML and not needed.  Many ways to parse XML: SAX/ DOM/ XSLT/ SimpleXML  REST is most lightweight and easy to use but offers the least functionality REST vs. SOAP Both REST and SOAP is widely adopted techniques for building distributed systems. REST is an architectural style for implementing systems on top of HTTP infrastructure. A large number of specifications have been developed on top of SOAP and there are large number of SOAP stacks both open source and proprietary out there implementing large part of stack Both these techniques have their advantages and drawbacks. Here are few of the advantages and disadvantages of each paradigm.
  • 4. Akshara Dave Page 4 SVIIT REST advantage:  Based on few simple principles which are already in wide adoption on the web itself  Can be implemented very quickely  Ideal for providing simple API’s to the users.(E.G. whether services, flicker, yahoo REST services)  Amount of learning required to get started is minimum in comparison to SOAP  Has a very large following amount the scripting community REST Disadvantage:  IF the system is a very large one, then designing based on REST could become a very complex task  Implementing security on a REST system is one major issue. Although HTTPS, and HTTP authentication can be used, they only provide transport level security. SOAP advantage:  Well designed  Has been widely adopted in industry  Large number of SOAP stacks available to choose from.  Has support for both transport level and message level security which is a big advantage over REST  Supports multiple protocol binding (not just HTTP)  Ideal for implementing complex enterprise systems since the SOAP stacks cater for security, reliability, transactions etc. SOAP Disadvantage:  Complex in comparison to REST  Big learning curve required  Difficult to debug a complex system One great thing about using WSF/ PHP is that it can support both of these techniques simultaneously. Reasons to use Web services: Web services operate on a service based model architecture. This the most compelling reason why we use web services. Second reason for using is that web services allow us to communicate among all different entities without affecting their existence. This forms the third reason for using a web service is that it is written separately from the application logic. The fourth reason why we use web service is that they improve the information flow between applications. The fifth reason why we use web service is that, web services, use text based protocol that all applications can understand.