How the PHP interface Controls access

Source: Internet
Author: User
Yesterday at the creation of the novel suddenly want to see their interface
Page Call Interface Press the F12 console is not able to display the call to those interfaces
Then click to see the parameters and return values
But the interface of the Get method I directly access return for illegal access
How does this control work?
(I don't know what language they are in the background, I'm learning php.)

Reply content:

Yesterday at the creation of the novel suddenly want to see their interface
Page Call Interface Press the F12 console is not able to display the call to those interfaces
Then click to see the parameters and return values
But the interface of the Get method I directly access return for illegal access
How does this control work?
(I don't know what language they are in the background, I'm learning php.)

I guess that request might have verified the HTTP referer, you directly access, and this HTTP header has no value.
Another approach is that the get has some kind of authentication, allowing access only once, and then accessing it again to prompt for unauthorized access.

The main topic of the proposed interface URL, in order to further help you.

Interface added permissions, we now webserver API of the key interface are added permissions, or more unsafe

@ Flying the small snail said yes, just check the referer. Another point is that you have to access it in AJAX mode. When requested, add the following header.

Accept: application/json, text/javascript, */*; q=0.01Referer: 域名X-Requested-With: XMLHttpRequest

You will have a smooth visit
PHP uses Get_headers () to get the header information and then verify

Of course to have access to, or add token, anyone can access unsafe, page wasted server resources to increase the burden on the server

  • Related Article

    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.