PHP uses the curl function POST to send a POST request to the ASP page, prompting invalid requests.

Source: Internet
Author: User
PHP uses the curl function POST to send a POST request to the ASP page. if the request is invalid, the following information is returned upon submission:
Error
The URL you requested cannot be obtained.

--------------------------------------------------------------------------------

When you try the following requests:

POST/card/pay_card.aspx HTTP/1.0
Host: pay.m3guo.com
X-Real-IP: 120.31.66.99
X-Forwarded-For: 120.31.66.99
Connection: close
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0 ;. net clr 2.0.50727 ;. net clr 3.0.04506.648 ;. net clr 3.5.21022 ;. net clr 3.0.20.6.2152 ;. net clr 3.5.30729; InfoPath.2 ;. NET4.0C ;. NET4.0E; VENUS_IE_ADDON-0.2.8.28; SE 2.X MetaSr 1.0)
Accept :*/*
Referer: http://pay.m3guo.com/card/pay_card.aspx
Cookie: ASP. NET_SessionId = j3if2045wkqnvnm010lbpe55
Content-Length: 1197
Content-Type: application/x-www-form-urlencoded
Secondary CT: 100-continue


The following error occurs:

Invalid Request
Invalid request
Some aspect of the HTTP Request is invalid. Possible problems:
Some aspects of the HTTP request are invalid. The following problems may occur:

Missing or unknown request method
The request method is missing or unknown.
Missing URL
URL missing
Missing HTTP Identifier (HTTP/1.0)
Http id Missing (HTTP/1.0)
Request is too large
The request command is too long.
Content-Length missing for POST or PUT requests
The POST or PUT request lacks the content length.
Illegal character in hostname; underscores are not allowed
The host name contains invalid characters. underlines are not allowed.

This cache server administrator: webmaster@fastcdn.com.





Please kindly advise. note: The PHP page is a self-written page that is submitted to the 'others' webpage via POST. Is there any restriction on the 'others' webpage...


Reply to discussion (solution)

Now, if someone else's webpage is a normal POST and the packet is captured, you will know what needs to be modified.

Well, I used the data obtained by The HTTPANALYZERSTD packet capture software. I submitted the post request data based on the data. I don't know where the error occurred! The system is dizzy. now, when someone else's webpage makes a normal POST and then captures the packet and proofreads it, you will know what needs to be modified.

Well, I used the data obtained by The HTTPANALYZERSTD packet capture software. I submitted the post request data based on the data. I don't know where the error occurred! The reply of referencing phpnewnew on the second floor is dizzy:
Now, if someone else's webpage is a normal POST and the packet is captured, you will know what needs to be modified.

So have you checked all the parameters? Are the POST content in the POST header completely consistent?

Reference the reply from xiaoyao_studio on the third floor:

Well, I used the data obtained by The HTTPANALYZERSTD packet capture software. I submitted the post request data based on the data. I don't know where the error occurred! The reply of referencing phpnewnew on the second floor is dizzy:
Now, if someone else's webpage is a normal POST and the packet is captured, you will know what needs to be modified.


So have you checked all the parameters? POST header POST ......
In PHP, the curl method can be set to URL, POST parameter and value, cookie, User-Agent, and Referer. how can other herder content be set with curl?

Reply by referencing phpnewnew on the 4th floor:
Reference the reply from xiaoyao_studio on the third floor:

Well, I used the data obtained by The HTTPANALYZERSTD packet capture software. I submitted the post request data based on the data. I don't know where the error occurred! The reply of referencing phpnewnew on the second floor is dizzy:
Now, if someone else's webpage is a normal POST and the packet is captured, you will know what needs to be modified.


So you are ......

This is usually the case. Is your curl cookie set correctly? What about post.

Reference the reply from xiaoyao_studio on the fifth floor:

Reply by referencing phpnewnew on the 4th floor:
Reference the reply from xiaoyao_studio on the third floor:

Well, I used the data obtained by The HTTPANALYZERSTD packet capture software. I submitted the post request data based on the data. I don't know where the error occurred! The reply of referencing phpnewnew on the second floor is dizzy:
Now, make a normal POST on someone else's webpage and capture the package with the current one ......

Well, I have checked all the matching items. they are absolutely consistent. how can I set the HTTP protocol with curl?
Set HTTP/1.1

I used to simulate some. Of course, HTTP/1.1 and HTTP/1.0 are not problematic when developing desktop programs.

Are there any fundamental differences between the two protocols? What have been changed when the HTTP protocol is updated to 1.1?

I used to simulate some. Of course, HTTP/1.1 and HTTP/1.0 are not problematic when developing desktop programs.

Are there any fundamental differences between the two protocols? What have been changed when the HTTP protocol is updated to 1.1?

Reply to reference phpnewnew on the eighth floor:
I used to simulate some. Of course, HTTP/1.1 and HTTP/1.0 are not problematic when developing desktop programs.


Are there any fundamental differences between the two protocols? What have been changed when the HTTP protocol is updated to 1.1?

You can only go to the official RFC documentation.

Reference the reply from xiaoyao_studio on the 10th floor:

Reply to reference phpnewnew on the eighth floor:
I used to simulate some. Of course, HTTP/1.1 and HTTP/1.0 are not problematic when developing desktop programs.


Are there any fundamental differences between the two protocols? What have been changed when the HTTP protocol is updated to 1.1?


You can only go to the official RFC documentation.

Okay. Let me check it out.

Do you have any results?

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.