开发者

POSTing php variable [duplicate]

开发者 https://www.devze.com 2023-03-21 05:14 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Passing $_POST values with cURL
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Passing $_POST values with cURL

I have a php variable $abc (text type). And I want to POST this data to http://www.example.com/xyz.php How can I do this? I cant use开发者_StackOverflow社区 GET.


You could use cURL extension:

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://www.example.com/xyz.php");
curl_setopt($curl, CURLOPT_POST, true);

$post = array(
    'key' => 'value'
);

curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_exec($curl);
0

精彩评论

暂无评论...
验证码 换一张
取 消