开发者

sending post data using fopen or curl? [closed]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜