Can I post data to php page using YQL?

北城以北 提交于 2019-12-08 09:39:17

问题


Can I post data to php page using YQL ?


回答1:


In short, yes.

With an <execute> block (docs), you can write JavaScript to make external HTTP requests: POSTs included. Have a read of one of Christian Heilmann's blog posts on the subject: Using YQL to read HTML from a document that requires POST data.

A brief example of the JavaScript to make such a request might look like:

// Prepare POST request
var url  = "http://www.postbin.org/1k2hsu7";
var body = "question=5579467&name=faressoft";
var req  = y.rest(url).accept('text/html').post(body);

// Make the request, and get response
var res  = req.response;

// Assign to YQL response object
response.object = res.body;


来源:https://stackoverflow.com/questions/5579467/can-i-post-data-to-php-page-using-yql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!