PHP使用search.submitPages文档推送链接返回44002?

发布于 8 年前作者 yma4129 次浏览最后编辑 8 年前来自 ask

1 回复
ylong
ylong1 楼5 年前

问题解决了,原来封装的方法不行重新封装了一个。

/**
 * @param $data
 * 提交数据
 * @param $post_url
 * 提交链接
 * @return bool|string
 */
function WeChatPOST($data, $post_url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $post_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
    $r = curl_exec($ch);
    curl_close($ch);
    return $r;
}