您可以使用 PHP 的 cURL 库来向 URL 使用 POST 方法提交字符串。以下是一个示例代码:/n/nphp/n<?php/n/$url = 'http://example.com/submit'; // 替换为您要提交的 URL/n/n/$data = '{/'data/':[{/'user_id/':2,/'u/':11111,/'d/':11111111},{/'user_id/':3,/'u/':22222,/'d/':222222}]}'; // 要提交的字符串/n/n/$ch = curl_init(/$url);/ncurl_setopt(/$ch, CURLOPT_POST, 1);/ncurl_setopt(/$ch, CURLOPT_POSTFIELDS, /$data);/ncurl_setopt(/$ch, CURLOPT_RETURNTRANSFER, true);/n/n/$response = curl_exec(/$ch);/ncurl_close(/$ch);/n/necho /$response;/n?>/n/n/n请将/$url替换为您要提交的 URL,然后运行上述代码即可将字符串通过 POST 方法提交到该 URL。

PHP 使用 cURL 库向 URL 提交 POST 数据 - 示例代码

原文地址: https://www.cveoy.top/t/topic/qoT7 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录