The content obtained by the browser is inconsistent with that obtained by the curl.

Source: Internet
Author: User
The returned result is a JSON string, but I use curl-l .... but cannot get the returned {code ...} the returned result is a JSON string, but I use curl-l http ://.... but cannot be obtained

Return

 404 Not Found404 Not FoundThe requested URL /mauth/usr/exists was not found on this server.

Reply content:

The returned result is a JSON string, but I cannot get it using curl-l http: //...

Return

 404 Not Found404 Not FoundThe requested URL /mauth/usr/exists was not found on this server.

The problem was later found to be a problem with the network link. The host running curl is isolated from the target server and cannot access each other. It hurts!

User-Agent, Cookies, Accept, Referer, and other parameters will affect the request results.

I usually use Fiddler to find out the minimum required parameters and cookies, and then obtain the curl.

The latest version of chrome's javascript debugging tool already supports Curl replication (it can fully simulate browser access, including header, cookie, and operating system information ), specifically, the network is knocked down first, and then the page is accessed, right-click the list point, there is a copy as curl. Then work with curl directly

The URL is wrong... or the server restricts the User-Agent...

Use–user-agentSimulate other browsers to see...

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.