Loading ...
Sorry, an error occurred while loading the content.
 

RE: [ysearchboss] Re: Using output...

Expand Messages
  • Desilets, Alain
    Use the start and count parameters. For example Start=0, count=50 will give you the first 50 hits. Start = 300, count=100 will give you hits 300 to 400 Alain
    Message 1 of 5 , Mar 20, 2013
      Use the start and count parameters.

      For example

      Start=0, count=50 will give you the first 50 hits.

      Start = 300, count=100 will give you hits 300 to 400

      Alain

      -----Original Message-----
      From: ysearchboss@yahoogroups.com [mailto:ysearchboss@yahoogroups.com] On Behalf Of sachin.finances
      Sent: Tuesday, March 19, 2013 7:48 PM
      To: ysearchboss@yahoogroups.com
      Subject: [ysearchboss] Re: Using output...



      I have figured some of it out and I am able to present results in an understandable format and also add css classes to it. The next problem is that I am getting all 50 results on the same page. How to I paginate it? I have pasted the entire code below. I need some examples on how to paginate the yahoo api search boss results in php.

      <?php

      foreach($results->bossresponse->web->results as $result) {
      echo '<h3><a href='.$result->url.'>'.$result->title.'</br>'.$result->abstract.'</a></h3>';

      }

      ?>

      -------------The entire code------------

      <?php
      require("OAuth.php");

      $cc_key = "XXXXXXX";
      $cc_secret = "XXXXXXXXX";
      $url = "http://yboss.yahooapis.com/ysearch/web";
      $args = array();
      $args["q"] = "yahoo";
      $args["format"] = "json";

      $consumer = new OAuthConsumer($cc_key, $cc_secret); $request = OAuthRequest::from_consumer_and_token($consumer, NULL,"GET", $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()); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $rsp = curl_exec($ch); $results = json_decode($rsp);

      ?>

      <html>

      <head>

      <title> sample Search </title>

      <link href="sample1.css" rel="stylesheet" type="text/css">

      </head>

      <body>

      <div id="resultsdiv">

      <?php

      foreach($results->bossresponse->web->results as $result) {
      echo '<h3><a href='.$result->url.'>'.$result->title.'</br>'.$result->abstract.'</a></h3>';

      }
      ?>

      </div>
      </body>
      </html>




      --- In ysearchboss@yahoogroups.com, "sachin.finances" <sachin.comments@...> wrote:
      >
      > Thanks Rahul.
      >
      > I am just starting, but, my application is a lot more complicated than that, so host services definitely won't work.
      >
      > 1) Do you have any educational links where I could read up a bit on creating these wrappers? Once I successfully create that, the app development should chug along nicely.
      >
      > 2) Also, is the output I pasted below json? Then, how do you create the output in xml? I tried replacing json with xml in the code, but didn't seem to work.
      >
      > Thanks a bunch,
      >
      > Sachin.
      >
      > --- In ysearchboss@yahoogroups.com, Rahul Hampole <rhampole@> wrote:
      > >
      > > Hi Sachin
      > > Thanks for considering BOSS for your needs. BOSS returns responses in JSON or XML and you can then write a HTML/CSS wrapper to display it.
      > >
      > > If you are simply looking for a product to show a simple search
      > > results page, I would recommend using BOSS Hosted
      > > (http://boss.yahoo.com/hosted-web-search). This will give you a full
      > > SRP by inserting some simple code and not have to worry about how to
      > > format the page, colors, etc
      > >
      > > Thanks
      > > BOSS Team
      > >
      > >
      > > From: "sachin.finances" <sachin.comments@<mailto:sachin.comments@>>
      > > Reply-To:
      > > "ysearchboss@yahoogroups.com<mailto:ysearchboss@yahoogroups.com>"
      > > <ysearchboss@yahoogroups.com<mailto:ysearchboss@yahoogroups.com>>
      > > Date: Thursday, March 14, 2013 12:32 PM
      > > To:
      > > "ysearchboss@yahoogroups.com<mailto:ysearchboss@yahoogroups.com>"
      > > <ysearchboss@yahoogroups.com<mailto:ysearchboss@yahoogroups.com>>
      > > Subject: [ysearchboss] Using output...
      > >
      > >
      > >
      > > Hello Everyone,
      > >
      > > I am a newbie, and want to ask a very basic question. I am planning
      > > for an application and search is an integral part of it. I will be
      > > using Yahoo boss services. I believe I have done everything right
      > > until now. I used some of Yahoo's sample OAuth php code obtained
      > > from here -
      > > http://developer.yahoo.com/boss/search/boss_api_guide/codeexamples.h
      > > tml#oauth_php
      > >
      > > I made only a couple of changes, inserted the proper keys, changed
      > > it to web only - $url = "http://yboss.yahooapis.com/ysearch/web";
      > >
      > > and changed the argument to 'ipad' as an example - $args["q"] =
      > > "ipad";
      > >
      > > Here are the results I am getting - It gives 49 results, I haven't pasted all of it. It gives the url, title, abstract etc. Exactly what I need. However, my question is how do I format this into a proper webpage. I don't know which format this is in, and what do I need to do to incorporate this into dreamweaver and format it with CSS and HTML.
      > >
      > > stdClass Object ( [bossresponse] => stdClass Object ( [responsecode] => 200 [web] => stdClass Object ( [start] => 0 [count] => 50 [totalresults] => 2750000 [results] => Array ( [0] => stdClass Object ( [date] => [clickurl] => http://www.apple.com/ipad/ [url] => http://www.apple.com/ipad/ [dispurl] => www.apple.com/ipad [title] => Apple - iPad [abstract] => iPad is a magical window where nothing comes between you and what you love. And it comes in two sizes. ) [1] => stdClass Object ( [date] => [clickurl] => http://en.wikipedia.org/wiki/IPad [url] => http://en.wikipedia.org/wiki/IPad [dispurl] => en.wikipedia.org/wiki/IPad [title] => iPad - Wikipedia, the free encyclopedia [abstract] => The iPad is a line of tablet computers designed and m! arketed by Apple Inc., which runs Apple's iOS operating system. The first iPad was released on April 3, 2010; the ... ) [2] => stdClass Object ( [date] => [clickurl] => http://www.amazon.com/s?ie=UTF8&page=1&rh=i%3Aaps%2Ck%3Aipad [url] => http://www.amazon.com/s?ie=UTF8&page=1&rh=i%3Aaps%2Ck%3Aipad [dispurl] => www.amazon.com/s?ie=UTF8&page=1&rh=i%3Aaps%2Ck%3Aipad [title] => Amazon.com: ipad [abstract] => Considering an iPad? Compare it to Kindle Fire HD Check out our easy side-by-side comparison chart to see how the newest iPad stacks up to Kindle Fire HD 8.9". ) [3] => .............
      > >
      >




      ------------------------------------

      Yahoo! Groups Links
    Your message has been successfully submitted and would be delivered to recipients shortly.