Title
Does PHP use Curl for other application interface calls, which are cross-domain requests?
Reply content:
Title
Does PHP use Curl for other application interface calls, which are cross-domain requests?
The same-origin policy prevents cross-domain security in the browser. And PHP's curl can be seen as a command-line browser (client), free from any restrictions, just as you would with file_get_contents downloading something on the Internet:
File_put_contents ('/tmp/logo.gif ', file_get_contents (' http://www.baidu.com/img/bdlogo.gif '));
For example, you package PHP into an Android app, then call PHP to launch an HTTP server, and then open a webview to access the local PHP service (using useragent to identify the application WebView), and then via PHP Curl gets the server-side data and returns it to WebView, which crosses the WebView's same-origin limit and makes it easy to access the network.
Do not belong at all, although use with confidence and boldness. Cross-domain exists only when the front-end JavaScript Ajax calls.
Cross-domain is a concept that exists in a browser.
Cross-domain is a front-end browser (such as an AJAX request), there is no cross-domain problem at the back end, curl is still very powerful.
The front-end aspect of the browser has a cross-domain.
It's just a mock request, PHP that's a cross-domain.
Found an article on the Internet, the understanding of cross-domain: Because of the browser-origin policy, the protocol that sends the request URL, domain name, port three between any one and the current page address is a cross-domain.
and a picture with an example:
Curl is a tool that uses URL syntax to transfer files and data, and supports many protocols, such as HTTP, FTP, Telnet, and so on. PHP supports the Curl library, which is used primarily to simulate some HTTP requests, such as form submissions, file uploads, and so on. These operations are often done through the PHP command line, so there is no limit to that.
I hope I can be of some help to you