Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小程序自然搜索推送post请求不支持 #546

Open
hlfsunshine opened this issue Nov 27, 2019 · 2 comments
Open

小程序自然搜索推送post请求不支持 #546

hlfsunshine opened this issue Nov 27, 2019 · 2 comments

Comments

@hlfsunshine
Copy link

在发送数据的时候,如果一次发送比较多的数据,数据直接跟在url之后,发送的数据在body中,目前不支持post,文档中写的支持,是怎么回事?

请求路径:POST
https://openapi.baidu.com/rest/2.0/smartapp/access/submitsitemap/api?access_token=ACCESS_TOKEN

@magenm
Copy link

magenm commented Dec 2, 2019

在发送数据的时候,如果一次发送比较多的数据,数据直接跟在url之后,发送的数据在body中,目前不支持post,文档中写的支持,是怎么回事?

请求路径:POST
https://openapi.baidu.com/rest/2.0/smartapp/access/submitsitemap/api?access_token=ACCESS_TOKEN

支持post请求,文档上写的很清楚:https://smartprogram.baidu.com/docs/introduction/rank_api/

@magenm
Copy link

magenm commented Dec 2, 2019

在发送数据的时候,如果一次发送比较多的数据,数据直接跟在url之后,发送的数据在body中,目前不支持post,文档中写的支持,是怎么回事?

请求路径:POST
https://openapi.baidu.com/rest/2.0/smartapp/access/submitsitemap/api?access_token=ACCESS_TOKEN

给你个demo
<?php $urls = array( '/pages/index1?id=1', '/pages/index2', ); $data['url_list'] = implode(",", $urls); $api = 'https://openapi.baidu.com/rest/2.0/smartapp/access/submitsitemap/api?access_token=xxx'; $ch = curl_init(); $options = array( CURLOPT_URL => $api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_NOBODY => false, CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_HTTPHEADER => array('Content-Type: application/x-www-form-urlencoded'), ); curl_setopt_array($ch, $options); $result = curl_exec($ch); echo $result; ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants