Beginning Ajax with PHP From Novice to Professional phần 8

Tham khảo tài liệu 'beginning ajax with php from novice to professional phần 8', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 9 WEB SERVICES 137 available functions including details of the input parameters and returned data . For example the PayPal SOAP Simple Object Access Protocol API provides a method you can execute called DoDirectPayment. If you ran a website that used PayPal to process customer transactions you might call this method passing in the customer s details and credit card number. The PayPal web server would then return data indicating the status of the transaction such as whether it succeeded or failed . Although in this example the developer connects directly to a third-party API . PayPal s API in this chapter we are going to look at creating our own web service as well as connecting to this service to use that data in a small Ajax application. There are several different standards available that can be used for web services such as SOAP and REST Representational State Transfer . We will be using SOAP in this chapter and we will be using the SOAP library that comes with PHP 5. SOAP is a protocol that allows remote procedures to be executed. All requests to and responses from a SOAP web service use XML. By using the SOAP library built into PHP the requests can easily be generated and responses can easily be interpreted. To use the code in this chapter your build of PHP needs to be compiled with the SOAP library enabled. On Linux the configuration parameter --with-soap is used while if you re using Windows you should include the following line in your file extension If you do not have this library available to you or if you are using PHP 4 you could also use a third-party library such as NuSOAP. Bring in the Ajax So what s nicer than being able to communicate over the Internet from client to server using SOAP The ability to do so asynchronously and with no page refreshes Besides being incredibly slick firing asynchronous requests from your web site code to a waiting SOAP server is incredibly functional and can allow for some powerful web .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
55    726    5    02-07-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.