Php-curl-php curl operation, belong to the cross-domain?

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.