【问题标题】:sending post data using fopen or curl? [closed]使用 fopen 或 curl 发送帖子数据? [关闭]
【发布时间】:2010-11-24 18:34:12
【问题描述】:

如何使用 fopen() 或 cURL 发送 POST 数据?

【问题讨论】:

  • 如果你想要一个答案,你必须写一个实际的问题。

标签: php post curl fopen postdata


【解决方案1】:

这是一个使用 PHP curl 发送 POST 数据的示例:

<?

$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);
?>

你可以在the PHP documentation找到更多关于curl的信息。

【讨论】:

    猜你喜欢
    • 2013-04-08
    • 1970-01-01
    • 2022-08-07
    • 2016-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多