POSTing php variable [duplicate]
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);
精彩评论