我需要帮助将发布请求推送到需要2个发布信息的json,这是使用
的代码imurl_exec($ch);
curl_setopt($ch, CURLOPT_URL, "https://www.webste/auth.json");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['id' => '3bQ6AqVg0PuE']));
curl_setopt($ch, CURLOPT_POSTFIELDS, ['auth_id=' => GetStringBetween(getURL("Websiteauthcode isat"),'$a.auth.data.auth_code = "', '"'));
curl_setopt($ch, CURLOPT_POST, 1);
$x = curl_exec($ch);
我希望它使用ID和Auth_Id击auth.json
我正在使用:
url_exec($ch);
curl_setopt($ch, CURLOPT_URL, "https://www.webste/auth.json");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['id' => '3bQ6AqVg0PuE']));
curl_setopt($ch, CURLOPT_POST, 1);
$x = curl_exec($ch);
它起作用了,但是他们此后添加了auth_id =要求,因此我需要弄清楚如何设置代码行curl_setopt($ch, CURLOPT_POSTFIELDS, ['auth_id=' => GetStringBetween(getURL("Websiteauthcode isat"),'$a.auth.data.auth_code = "', '"'));
,谢谢您的帮助或建议!
答案 0 :(得分:0)
您可以将两个参数都放在数组中。
$auth_id = GetStringBetween(getURL("Websiteauthcode isat"),'$a.auth.data.auth_code = "', '"');
curl_setopt($ch, CURLOPT_POSTFIELDS, ['id' => '3bQ6AqVg0PuE', 'auth_id' => $auth_id]);