0

Very Confused Plus Sample Errors

Coming developing applications in BOSS, have been try to get the simplest of code samples to work, but am the most confused as to: "consumerKey", "consumerKeySecret","applicationId". First question is, when I register a new application, what options to I choose, "Single Ath", "BOSS" or not sure...?

As for the error I am getting is from the following code sample: http://developer.yahoo.com/yos/tutorials/e...ql_example.phps. The error I am getting is the following: "Fatal error: Call to a member function query() on a non-object in /var/www/yosdk/sample/1.php on line 37" Server location: http://89.233.173.91/yosdk/sample/2.php

Thanks in Advance!

by
11 Replies
  • QUOTE (Diego M @ Feb 20 2009, 09:17 AM) <{POST_SNAPBACK}>
    Coming developing applications in BOSS, have been try to get the simplest of code samples to work, but am the most confused as to: "consumerKey", "consumerKeySecret","applicationId". First question is, when I register a new application, what options to I choose, "Single Ath", "BOSS" or not sure...?

    As for the error I am getting is from the following code sample: http://developer.yahoo.com/yos/tutorials/e...ql_example.phps. The error I am getting is the following: "Fatal error: Call to a member function query() on a non-object in /var/www/yosdk/sample/1.php on line 37" Server location: http://89.233.173.91/yosdk/sample/2.php

    Thanks in Advance!



    Hi,

    It looks like you are trying to build a standalone application to use oauth, in this case you can go to https://developer.yahoo.com/dashboard/ and create a new oauth application and update the consumer key / secret in the example scrupt and it should work as expected.

    If you want to run the application on your own web site use oauth. If you want to build your application on yahoo application platform, then create a new open app.
    0
  • QUOTE (Dustin Whittle @ Feb 20 2009, 10:00 AM) <{POST_SNAPBACK}>
    Hi,

    It looks like you are trying to build a standalone application to use oauth, in this case you can go to https://developer.yahoo.com/dashboard/ and create a new oauth application and update the consumer key / secret in the example scrupt and it should work as expected.

    If you want to run the application on your own web site use oauth. If you want to build your application on yahoo application platform, then create a new open app.



    I have setup an OAuth-enabled account, and have plugged the information into different servers and I still get the "above" error. Can I simply do what I do with BOSS but with YQL instead. http://query.yahooapis.com/v1/public/yql?q...p;APPID=MyAPPID?

    Thanks!
    0
  • Can the sample files be placed in any directory in the verified domain? could this be a reason that the sample files are not working?

    QUOTE (Diego M @ Feb 20 2009, 11:21 AM) <{POST_SNAPBACK}>
    I have setup an OAuth-enabled account, and have plugged the information into different servers and I still get the "above" error. Can I simply do what I do with BOSS but with YQL instead. http://query.yahooapis.com/v1/public/yql?q...p;APPID=MyAPPID?

    Thanks!
    0
  • YQL does not accept an appid for search.web, so that will not work as you expect..

    QUOTE
    Can the sample files be placed in any directory in the verified domain? could this be a reason that the sample files are not working?


    Yes you can put the yos sdk in any subdirectory. Can you provide the source code for your problem?

    To make a yql call using the yossdk:

    CODE
    // get app instance for yql
    $yql = 'select * from search.web where query = "microformats" and view = "searchmonkey_feed"'
    $application = new YahooApplication($consumerKey, $consumerKeySecret);
    $data = $application->query($yql);
    0
  • Here are three codes which are still giving me errors.

    http://www.buildasearch.com/_B/Y/yosdk/sample/1.phps
    http://www.buildasearch.com/_B/Y/yosdk/sample/2.phps
    http://www.buildasearch.com/_B/Y/yosdk/sample/sampleapp.phps

    Thanks!


    QUOTE (Dustin Whittle @ Feb 23 2009, 04:20 PM) <{POST_SNAPBACK}>
    YQL does not accept an appid for search.web, so that will not work as you expect..



    Yes you can put the yos sdk in any subdirectory. Can you provide the source code for your problem?

    To make a yql call using the yossdk:

    CODE
    // get app instance for yql
    $yql = 'select * from search.web where query = "microformats" and view = "searchmonkey_feed"'
    $application = new YahooApplication($consumerKey, $consumerKeySecret);
    $data = $application->query($yql);
    0


  • Did you change the consumer key (etc) entries in the samples to one of your own? the ones in the samples are not valid:

    e.g.

    CODE
    // Your consumer key goes here.
    $consumerKey = "dj0yJmk9ajZJNU15WUlsOUNyJmQ9WVdrOVFt...";

    // Your consumer key secret goes here.
    $consumerSecret = "9be47fdda2b24e230d3...";

    // Your application ID goes here.
    $applicationId = "BaO...";


    You'll need to provide these, which you get from https://developer.yahoo.com/dashboard/ (choose an oauth application)

    Alternatively, for these public data sources you can just "curl" the public versions to get going (add a /public before the yql part of the path)

    Jonathan
    0
  • Jonathan,

    Is it safe for me to paste my "consumerKey" and "consumerSecret" codes here?



    QUOTE (Jonathan @ Mar 2 2009, 01:13 PM) <{POST_SNAPBACK}>
    Did you change the consumer key (etc) entries in the samples to one of your own? the ones in the samples are not valid:

    e.g.

    CODE
    // Your consumer key goes here.
    $consumerKey = "dj0yJmk9ajZJNU15WUlsOUNyJmQ9WVdrOVFt...";

    // Your consumer key secret goes here.
    $consumerSecret = "9be47fdda2b24e230d3...";

    // Your application ID goes here.
    $applicationId = "BaO...";


    You'll need to provide these, which you get from https://developer.yahoo.com/dashboard/ (choose an oauth application)

    Alternatively, for these public data sources you can just "curl" the public versions to get going (add a /public before the yql part of the path)

    Jonathan
    0
  • QUOTE (Diego M @ Mar 2 2009, 08:25 PM) <{POST_SNAPBACK}>
    Jonathan,

    Is it safe for me to paste my "consumerKey" and "consumerSecret" codes here?


    No its not, but if those phps files where the actual ones you're using, then the keys are clearly wrong. If you were just linking them to show the code and had taken the effort to obscure the keys then thats a good thing - but doesnt help us working out what the issue is.

    Can you clarify?

    Jonathan
    0
  • The links to the code are the actual code samples giving me errors. I cut-off parts my actual "appid" and "secret" codes for security reasons.

    Thanks.


    QUOTE (Jonathan @ Mar 4 2009, 11:43 AM) <{POST_SNAPBACK}>
    No its not, but if those phps files where the actual ones you're using, then the keys are clearly wrong. If you were just linking them to show the code and had taken the effort to obscure the keys then thats a good thing - but doesnt help us working out what the issue is.

    Can you clarify?

    Jonathan
    0
  • If you have control over your PHP setup, I would suggest using pecl/oauth instead of the userspace SDK. It is much faster, and easier to use. It does both 2-legged and 3-legged OAuth. Here is a simple 2-legged example. oauth_secret.inc just sets the $consumerKey and $consumerSecret variables. See http://php.net/oauth for documentation. And there are more examples here http://cvs.php.net/viewvc.cgi/pecl/oauth/examples/

    CODE
    <?php
    require './oauth_secret.inc';
    $url = 'http://query.yahooapis.com/v1/yql';
    try {
    $o = new OAuth($consumerKey,$consumerSecret,
    OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_AUTHORIZATION);
    $q = <<<EOB
    select * from html where xpath=
    '//tr//a[@href="/wiki/Capital_(political)"]/../../../td[2]/a/text()'
    and url in (select url from search.web where url like '%wikipedia%'
    and query='Denmark' limit 1)
    EOB;
    $o->fetch("$url?q=".rawurlencode($q)."&format=json");
    /* Uncomment for debugging
    $response_info = $o->getLastResponseInfo();
    echo "<pre>".print_r($response_info,true)."</pre>";
    */
    $result = json_decode($o->getLastResponse(),true);
    foreach($result['query']['diagnostics']['url'] as $u) {
    echo "{$u['content']}<br>\n";
    }
    echo "<b>Answer: </b>{$result['query']['results']}";
    } catch(Exception $E) {
    echo "Error: [".$E->errorMessage."]<br>\n";
    echo "Response: [".$E->lastResponse."]<br>\n";
    exit;
    }
    ?>
    0
  • Hi I need some clarifications regarding the Yahoo boss XML format I have used the url like this "http://yboss.yahooapis.com/ysearch/news,web,images?oauth_version=%221.0%22,oauth_nonce=%22a1e88d60b3c07d416fb43f21024c40b3%22,oauth_timestamp=%221240269666%22,oauth_consumer_key=%22dj0yJmk9Vdfdsfds2JpZ1FKQmNIS3NhJmQ9WVdrOVlYRlNPSFpZTjJzbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1mYw--%22,oauth_signature_method=%22HMAC-SHA1%22,oauth_signature=%22kEBJXyRAFC4RYnm9Fegwt3nIO%2Fo%3C%22&format=xml&start=0&count=15"

    The consumer key which i placed here is wrong one.

    when i placed the above url in browser i am getting the error like "Please provide valid credentials. OAuth oauth_problem="version_rejected", realm="yahooapis.com" "

    Anyone help me over this!

    0

Recent Posts

in YQL