开发者

Can I post data to php page using YQL?

Can I post 开发者_如何学JAVAdata to php page using YQL ?


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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜