我可以使用YQL将数据发布到php页面吗? [英] Can I post data to php page using YQL?

查看:98
本文介绍了我可以使用YQL将数据发布到php页面吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用YQL将数据发布到php页面吗?

解决方案

b

使用< execute> 块( docs ),您可以编写JavaScript来发出外部HTTP请求:包括POST。阅读Christian Heilmann关于此主题的博客文章之一:使用YQL从需要POST数据的文档中读取HTML。



  //准备POST请求
var url =http://www.postbin.org/1k2hsu7;
var body =question = 5579467& name = faressoft;
var req = y.rest(url).accept('text / html')。post(body);

//发出请求并获得响应
var res = req.response;

//分配给YQL响应对象
response.object = res.body;


Can I post data 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;

这篇关于我可以使用YQL将数据发布到php页面吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆