Retrieve username, password parameters passed through curl

前端 未结 4 1349
轮回少年
轮回少年 2021-01-07 12:34

I am trying to send username and password parameters to a url using curl, and I want to retrieve them. I send the parameters to a page, like the following:

&         


        
4条回答
  •  不要未来只要你来
    2021-01-07 13:04

    to send parameters to a web page you can use 1 of two methods GET or POST

    GET is where the parameters are appended to the name of the resource you are getting

    e.g $url = "http://localhost/sample.php?name=" . urlencode( $value )

    the other choice is via a POST. post is sent to the server as a page of information to do this with curl you create a post with

    curl_setopt($ch, CURLOPT_POSTFIELDS, 'name=' . urlencode( $value ) . '&name2=' . urlencode( $value2 ));

    If on the other hand you are talking about Headers, then you can access them through the $_SERVER['headername'] array.

    DC

提交回复
热议问题