开发者

sending post data using fopen or curl? [closed]

开发者 https://www.devze.com 2023-01-26 15:01 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reope开发者_开发技巧ned, visit the help center. Closed 12 years ago.

How can I send POST data using fopen() or cURL?


Here's an example that uses the PHP curl to send POST data:

<?

$ch = curl_init();

$data = array('var1' => 'Foo', 'var2' => 'Bar');

curl_setopt($ch, CURLOPT_URL, 'http://localhost/');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_exec($ch);
?>

You can find more information on curl in the PHP documentation.

0

精彩评论

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

关注公众号