How to use the curl Command in PHP

Source: Internet
Author: User
Please use curlcommand in PHP for example, curl-xpost-v-ccookies.txt-d & quot ;{\& quot; username \ & quot ;:\& quot; uname \ & quot ;,\& quot; password \ & quot ;: \ & quot; pasword \ & quot;} & quot: how can I use the curl Command in PHP?


As follows:
Curl-x post-v-c cookies.txt-d "{\" username \ ": \" uname \ ", \" password \": \ "pas word \"} "-H" Content-Type: application/json "xxx.com/ah/session
This command

How to use the above commands in PHP?

Who can provide the complete example ~~~~~~~~~




------ Solution --------------------
// 1. initialization
$ Ch = curl_init ();
// 2. set options, including URL
Curl_setopt ($ ch, CURLOPT_URL, "http://www.nettuts.com ");
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
// 3. execute and obtain the HTML document content
$ Output = curl_exec ($ ch );
// 4. release the curl handle
Curl_close ($ ch );



------ Solution --------------------
Http://www.chinaz.com/program/2010/0119/104346_2.shtml
------ Solution --------------------
Discussion

Reference:

I can't even read the materials? Do you understand the meaning of the curl command line.


I just don't understand the meaning of this command line.
So I want to know how PHP translates this command line.

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.