Questions about curl_setopt----online, etc.

Source: Internet
Author: User
curl_setopt ($ch, Curlopt_postfields, $postfield); Set the string for post submission
1. Where is the curlopt_postfields stored in the header of HTTP or not?
2. What is the difference between the Post method of form form in Web page?
I do Delphi, and then the Idhttp control simulates the post of the Web page, but it seems a little different from PHP.
$postfield here only to see that there is a specified value, do not see the specified name attribute hey.


Reply to discussion (solution)

$postfield is a string that connects all of the form's name and value to & with key-value pairs.

According to the HTTP protocol, it does not belong to the header, but to the body (which should be separated from the header part \r\n\r\n)

$postfield is a string that connects all of the form's name and value to & with key-value pairs.

According to the HTTP protocol, it does not belong to the header, but the body (and the header part should have \r\n\r\n separated) The Post method is separated by a newline? If you do not specify his name, only one value is submitted what is the result?

The legal format should be similar to the ' Para1=val1&para2=val2& ... ' or use a field name as the key value, and the field data as the value of the array

You only pass value, then the target page will not be able to get the value you submitted.

No matter what the way, commit is to send a string, the General post is done by the browser
Curl just simulates post, just organizes some parameters and sends them instead of the browser
You two Delphi month ranked first, should also have done socket bar, socket is the string in accordance with the HTTP specification splicing up send?

I said it's a key-value pair, and it's got to be name.
name=abcdefg&password=123456 ...
Only value, the result is that the server can not find the required variables?

No matter what the way, commit is to send a string, the General post is done by the browser
Curl just simulates post, just organizes some parameters and sends them instead of the browser
You two Delphi month ranked first, should also have done socket bar, socket is the string in accordance with the HTTP specification splicing up send?

I said it's a key-value pair, and it's got to be name.
name=abcdefg&password=123456 ...
Only value, the result is that the server can not find the required variables? Thank you two bit, the problem has been solved!

  • 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.