我正在尝试使用Yahoo!添加yahoo登录到php网站 社交SDK - PHP5,似乎是官方和最新的PHP SDK
我从https://developer.yahoo.com/apps/create/创建了一个应用程序,并按照示例中提供的说明进行操作.
因此,在此早期,我必须定义客户端ID,客户端密钥,应用程序ID和回调URL以设置YahooOAuthApplication类.
$CONSUMER_KEY = '##';
$CONSUMER_SECRET = '##';
$APPLICATION_ID = '##';
$CALLBACK_URL = '##';
$oauthapp = new YahooOAuthApplication($CONSUMER_KEY, $CONSUMER_SECRET, $APPLICATION_ID, $CALLBACK_URL);
Run Code Online (Sandbox Code Playgroud)
我访问了https://developer.yahoo.com/apps/并选择了我之前创建的应用程序但我找不到应用程序ID.
在应用程序中我也尝试了url的最后一部分但是也没有用.
尝试在YQL控制台中进行查询.这个工作正常:
select * from weather.forecast where woeid=1989965
Run Code Online (Sandbox Code Playgroud)
但我想获取公制系统(摄氏度)中的值,所以我使用此查询:
select * from weather.forecast where woeid=1989965 and unit='c'
Run Code Online (Sandbox Code Playgroud)
我得到一个null结果:
{
"query": {
"count": 0,
"created": "2016-03-28T01:46:08Z",
"lang": "ru",
"results": null
}
}
Run Code Online (Sandbox Code Playgroud)
我可以自己转换价值观,但我希望我能让它开箱即用......
我想构建一个应用程序来查询Yahoo!中的数据。幻想联盟,但无法通过三足式OAuth身份验证,希望有人可以给我快速演示,或为我提供相关教程。
我愿意使用NodeJS,Python或PHP。
我已经注册了一个API,并获得了“消费者密钥”和“消费者秘密”。
他们的文档包含两个PHP示例(我无法使用),并引用了OAuth.net的库列表。
但是,让我们以Python为例。该rauth文档只列出的第一站,我怎么完成其他2条腿?
from rauth import OAuth2Service
yahoo = OAuth2Service(
client_id='mykey',
client_secret='mysecret',
name='yahoo',
authorize_url='https://api.login.yahoo.com/oauth/v2/request_auth',
access_token_url='https://api.login.yahoo.com/oauth/v2/get_token',
base_url='https://api.login.yahoo.com/oauth/v2/')
url = yahoo.get_authorize_url()
Run Code Online (Sandbox Code Playgroud)
尽管yahoofantasysandbox似乎已经存在了,但我在GitHub.com上发现的几乎所有示例都存在很长时间,并且存在兼容性问题。
本教程推荐使用幻想运动,但我没有看到很多有关实现或示例的细节。
有人可以为此指出正确的方向,还是可以给我演示工作代码?
我正在尝试设置一个消耗Yahoo Fantasy体育API的简单应用程序,并允许通过YQL执行查询.
class Program
{
static void Main(string[] args)
{
string yql = "select * from fantasysports.games where game_key in ('268')";
//var xml = QueryYahoo(yql);
// Console.Write(xml.InnerText);
string consumerKey = "--my key--";
string consumerSecret = "--my secret--";
var xml = QueryYahoo(yql, consumerKey, consumerSecret);
Console.Write(xml.InnerText);
}
private static XmlDocument QueryYahoo(string yql)
{
string url = "http://query.yahooapis.com/v1/public/yql?format=xml&diagnostics=false&q=" + Uri.EscapeUriString(yql);
var req = System.Net.HttpWebRequest.Create(url);
var xml = new XmlDocument();
using (var res = req.GetResponse().GetResponseStream())
{
xml.Load(res);
}
return xml;
}
private static XmlDocument …Run Code Online (Sandbox Code Playgroud) 脚本错误:在子元素关闭之前无法修改父容器元素.我该怎么办?我单击是,我的网页不会显示.
在我的产品页面代码的开头,我有:http://pastebin.com/iiUfMq1v
除了IE8之外,每个浏览器都能正常工作,IE8是唯一一个抛出任何错误的浏览器.
有任何想法吗?
我关注此链接:https://github.com/yahoo/yos-social-objc用于检索雅虎联系人.
在提供所有凭证(即密钥,消费者密钥,应用程序ID)之后,它将进入Safari浏览器进行登录.但登录后,它显示此消息:
完成雅虎的分享!使用xxxx信息,将代码xxxx输入xxxx
所以,我没有得到我应该输入此代码的地方?它将如何重定向到我的应用程序.
Plist中缺少什么我应该在Plist中添加什么?
任何帮助将不胜感激.
我目前正在使用以下代码:
<?php
/* Pre-requisite: Download the required PHP OAuth class from http://oauth.googlecode.com/svn/code/php/OAuth.php. This is used below */
require("OAuth.php");
$url = "https://yboss.yahooapis.com/geo/placespotter";
$cc_key = "MY_KEY";
$cc_secret = "MY_SECRET";
$text = "EYES ON LONDON Electric night in 100-meter dash";
$args = array();
$args["documentType"] = urlencode("text/plain");
$args["documentContent"] = urlencode($text);
$consumer = new OAuthConsumer($cc_key, $cc_secret);
$request = OAuthRequest::from_consumer_and_token($consumer, NULL,"POST", $url,$args);
$request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL);
$url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args));
$ch = curl_init();
$headers = array($request->to_header());//.',Content-Length: '.strlen($text));
//print_r($headers.',Content-Length: '.strlen($text));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用yql进行雅虎财务数据.我检查了YQL控制台上的Show Community Table,以查看Yahoo标签下的数据库.我可以看到它下面的表格,但我没有得到结果,如下所示:::
select*from yahoo.finance.analystestimate where where in('YHOO')
{
"query": {
"count": 1,
"created": "2016-03-28T10:25:01Z",
"lang": "en-US",
"diagnostics": {
"url": [
{
"execution-start-time": "1",
"execution-stop-time": "767",
"execution-time": "766",
"content": "http://www.datatables.org/yahoo/finance/yahoo.finance.analystestimate.xml"
},
{
"execution-start-time": "771",
"execution-stop-time": "1821",
"execution-time": "1050",
"content": "http://finance.yahoo.com/q/ae?s=YHOO"
}
],
"publiclyCallable": "true",
"javascript": {
"execution-start-time": "769",
"execution-stop-time": "1823",
"execution-time": "1054",
"instructions-used": "5139",
"table-name": "yahoo.finance.analystestimate"
},
"user-time": "1824",
"service-time": "1806",
"build-version": "0.2.842"
},
"results": {
"results": {
"symbol": "YHOO"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这里结果显示为空..有什么变化?我怎么知道发生了什么?
我可以使用替代解决方案来获取此数据吗?
在过去1-2天内,我用来从雅虎财经下载历史股票价格的http查询一直没有运作.我一直在使用的链接是下面的第一个,但我也尝试了其他三个(因为我看到其他人使用它们):
http://real-chart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
https://real-chart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
http://ichart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
https://ichart.finance.yahoo.com/table.csv?s=TRQ&d=6&e=3&f=2016&g=d&a=5&b=25&c=2016&ignore=.csv
Run Code Online (Sandbox Code Playgroud)
我注意到一件有趣的事情是雅虎网站本身提供的链接(手动下载数据)发生了变化.链接曾经是上面列表中的第一个(毕竟,这是我得到它的地方),但现在它如下:
https://query1.finance.yahoo.com/v7/finance/download/TRQ?period1=1466805600&period2=1467496800&interval=1d&events=history&crumb=DuX0UxVwtN0
Run Code Online (Sandbox Code Playgroud)
请注意,理论上所有这些链接应该从2016/06/25到2016/07/03检索相同的数据:TRQ的股票价格(只是一个例子,我也尝试过例如AAPL).
这个新链接可以在浏览器中或我的程序中运行,但它很难扩展,因为它需要一个会话cookie; 如果您只是省略最后一个查询参数,则会收到错误消息,说明您未获得授权.这个问题询问如何以自动方式创建所述会话cookie; 但是,我想通过尝试直接访问YQL数据库来完全避免这个问题.
我尝试使用以下链接直接使用YQL API(将空格转换为%20等,这不是问题):
https://query.yahooapis.com/v1/public/yql?q=
select * from yahoo.finance.historicaldata where symbol = "TRQ"
and startDate = "2016-06-25"
and endDate = "2016-07-03"
&format=json
&diagnostics=true
&env=store://datatables.org/alltableswithkeys
&callback=
Run Code Online (Sandbox Code Playgroud)
此链接返回"连接被拒绝"错误.正如这个问题所暗示的那样,这可能是因为datatables.org网站已关闭(链接中的问题是指大约一年前发生的停机事件).有没有人有这方面的更多信息?
谢谢.