Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Partial Fix Problem while getting data from yahoo

Discussion in 'Stock Trader Resolved Bug Reports' started by arnaudhc, Feb 3, 2015.

  1. arnaudhc

    arnaudhc New Member

    Hi , since yesterday the getQuotes method from the stock model often fails.
    The file returned by yahoo contains a 301 error.

    This can be solved by using curl with followlocation option instead of file($request)

    //Change - use curl
    //$response = implode ('', file($request));
    //curl seems the best way
    $ch curl_init();
    $result curl_exec($ch);
    //deal with it later..
    return false;
    $responses explode("\r\n",trim($result));
  2. Bob

    Bob Developer Staff Member

    Sounds like a reasonable change. Going to do some stress testing on it before I'd implement it however (and also going to look into why yahoo is returning 301's).
  3. Bob

    Bob Developer Staff Member

    so far all the stress testing has passed. Still have a lot of other testing to do, but I'll probably change it. There is already the curl requirement (for the lookup functionality), so it won't effect those that already have the addon installed.
    arnaudhc likes this.
  4. Bob

    Bob Developer Staff Member

    I marked this as Partial Fix (even those its not a FIX, its just changing the data fetching method and still doesn't FIX the connection issues which are on Yahoo's end).

    I've modified the getQuotes AND getQuote methods to use CURL. I've also added in error messages for both (2 different error messages as one applies directly to fetching a single stock and the other effects the fetching of multiple stocks (which effects a lot more functionality).

    Phrase: nflj_stocktrader_get_quote_api_error_message

    This message will pop up in places that deal with a SINGLE stock only (like on the lookup)

    Phrase: nflj_stocktrader_get_quotes_api_error_message

    As you will notice, now when there is an issue with the API, the entire PAGE not rendered and an error message is presented. This is to stop people from generating further errors by clicking on individual stocks (which will generate the above error message).

    NOTE: some pages will still display (like Your History and Top Portfolios) as they do not require accessing the API to render the page.
    arnaudhc likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.