SlideShare a Scribd company logo
Creating SlideShare Instant   Demo :   http://home.iitb.ac.in/~saket.kumar/slideshare Source: https://github.com/saketkc/SlideShare-Instant t Saket Choudhary http://home.iitb.ac.in/~saket.kumar IIT Bombay
What is “Instant”? 1.Get spontaneous results “on the go” while you type. 2.Saves time 3.First results are generally preffered reults hence search the “browsing  Example: 1. Google Search Instant(Results appear as you type) 2. YouTube Instant : The thing that actually landd up its creator with a job offer !
SlideShare Instant !   Get instant results for your Slide/Document Search !   Not Satisfied with the first result?? Go Click the “Next” button ! Not So Fast Yet ! Well the source code is all open Go edit it ! Just Respect the Open Source Terms: https://github.com/saketkc/SlideShare-Instant Demo available at:  http://home.iitb.ac.in/~saket.kumar/slideshare
Requirements 1.AJAX calls (Hail Google !) 2.PHP  ( My favourite on Web So far ! I am falling in love with  RoR  though) 3. Javascript(jquery) 4. CSS (Brains with Beauty is the way everyonr likes it ! )
Code Snippets <input type=&quot;text&quot; class='search_input'  /><br/> Define an “onkeyup” event sen an ajax GET request to 'ajax.php' containing the parameters:  the 'ajaxeeequest' and 'query' $(&quot;.search_input&quot;).keyup(function()  { var search_input = $(this).val(); var keyword= encodeURIComponent(search_input); $.ajax({   type: &quot;GET&quot;,   url: &quot;ajax.php&quot;,    data:{'op':'ajaxrequest','query':keyword},   success: function(msg){    $('.inner').html(msg); //fetch the Slide and echo it on the page   }  }); });
Contact Me I am a Sophomore at IIT Bombay as of 2011 . I can be contacted at  [email_address]
Ajax.php <?php session_start(); $var=array(); global $vaar; //$var=[]; if ($_GET['op']==&quot;ajaxrequest&quot;) {$var=$_GET['query']; $api_key=&quot;8GD14Jk1&quot;; $secret=&quot;mnFaUN4s&quot;; $proxy=&quot;proxy&quot;; $pass=&quot;user:pwd&quot;; $timeout=0; $ts=time(); $hash=sha1($secret.$ts); # use CURL library to fetch remote file $apiurl=&quot;http://www.slideshare.net/api/2/search_slideshows?q=$var&quot;; $ch = curl_init(); curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_PROXYPORT,80); curl_setopt($ch, CURLOPT_PROXYUSERPWD,$pass); $url = $apiurl.&quot;&api_key=$api_key&ts=$ts&hash=$hash&items_per_page=1&quot;; curl_setopt ($ch, CURLOPT_URL, $url); $file_contents = curl_exec($ch); $xml = simplexml_load_string($file_contents); $number=1; foreach ( $xml->Slideshow as $files) {  $_SESSION[$var][$number]=$files->Embed;    //echo $_SESSION['sad']['2'];  $vaar[$number]=$_SESSION[$var][$number];  echo ($vaar[$number]);  $number=$number+1; } }
if ($_GET['op']==&quot;numberrequest&quot;) { // session_start(); $num=$_GET['number']; $query=$_GET['query']; $api_key=&quot;8GD14Jk1&quot;; $secret=&quot;mnFaUN4s&quot;; $proxy=”proxy” $pass=&quot;user:pwd”; $timeout=0; $ts=time(); $hash=sha1($secret.$ts); # use CURL library to fetch remote file $apiurl=&quot;http://www.slideshare.net/api/2/search_slideshows?q=$query&quot;;
$ch = curl_init(); curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_PROXYPORT,80); curl_setopt($ch, CURLOPT_PROXYUSERPWD,$pass); $url = $apiurl.&quot;&api_key=$api_key&ts=$ts&hash=$hash&items_per_page=$num&quot;; curl_setopt ($ch, CURLOPT_URL, $url); $file_contents = curl_exec($ch); //$res =  simplexml_load_file($file_contents); $xml = simplexml_load_string($file_contents); $number=1; foreach ( $xml->Slideshow as $files) {  $_SESSION[$var][$number]=$files->Embed;    $vaar[$number]=$_SESSION[$var][$number];  if ($number==$num)  {  echo $files->Embed;  }    $number=$number+1; }}   ?>
Index.php <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;> <html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;> <head> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; />  <LINK href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;> <title>SlideShare Instant</title> <script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;></script> <script src=&quot;http://chrisslidesharehacks.googlecode.com/files/previewer2.js&quot;></script> <script type=&quot;text/javascript&quot;> $(document).ready(function() { var number=01; $(&quot;.search_input&quot;).focus(); $(&quot;.search_input&quot;).keyup(function()  { var search_input = $(this).val(); var keyword= encodeURIComponent(search_input); $.ajax({   type: &quot;GET&quot;,   url: &quot;ajax.php&quot;,   data:{'op':'ajaxrequest','query':keyword},   success: function(msg){   $('.inner').html(msg);   }  }); });
$('#next').click(function() {   number=number+1;   var keyword = $(&quot;.search_input&quot;).val();   $.ajax({   type: &quot;GET&quot;,   url: &quot;ajax.php&quot;,   data:{'op':'numberrequest','query':keyword,'number':number},   success: function(msg){   $('.inner').html(msg);//=msg;   }  }); }); $('#prev').click(function() {     number=number-1;   var keyword = $(&quot;.search_input&quot;).val();
$.ajax({   type: &quot;GET&quot;,   url: &quot;ajax.php&quot;,   data:{'op':'numberrequest','query':keyword,'number':number},   success: function(msg){   $('.inner').html(msg);//=msg;   }  }); }); }); </script> <body> <center> SlideShare Instant Query<input type=&quot;text&quot; class='search_input'  /><br/> <div class=&quot;container&quot;> <div class=&quot;inner&quot;></div> <button id=&quot;next&quot;> Next--</div> <button id=&quot;prev&quot;>--Prev</div> </div> </center> </body>

More Related Content

PPTX
LinkedIn Platform at LeWeb 2010
PPT
PHP 5 Sucks. PHP 5 Rocks.
KEY
关于 Html5 那点事
PDF
Selenium for-ops
PDF
REST, the internet as a database?
PDF
HTML5 Essentials
PPT
What's new in Rails 2?
PDF
BDD - Writing better scenario
LinkedIn Platform at LeWeb 2010
PHP 5 Sucks. PHP 5 Rocks.
关于 Html5 那点事
Selenium for-ops
REST, the internet as a database?
HTML5 Essentials
What's new in Rails 2?
BDD - Writing better scenario

What's hot (20)

TXT
Learn chinese name from getting a chinese name
PDF
BDD with cucumber
PPT
Facebook Development with Zend Framework
PDF
Using HTML5 sensibly
KEY
Html5的应用与推行
PDF
Multimedia on the web - HTML5 video and audio
KEY
Mojolicious - A new hope
ODP
Mojolicious on Steroids
PPTX
Behat - Drupal South 2018
PPTX
計算機概論20161205
PDF
Desafios do Profissionalismo Ágil
PPTX
計算機概論20161212
PPTX
Reno-Tahoe WordCamp 2011 - WordPress End User Security - Dre Armeda
PPT
Advanced and Hidden WordPress APIs
KEY
Page Caching Resurrected
PPT
Evolution of API With Blogging
PDF
Web Projects: From Theory To Practice
PPT
Php Basic Security
PDF
#3 HTML & CSS [know-how]
PDF
HTML5 and the web of tomorrow!
Learn chinese name from getting a chinese name
BDD with cucumber
Facebook Development with Zend Framework
Using HTML5 sensibly
Html5的应用与推行
Multimedia on the web - HTML5 video and audio
Mojolicious - A new hope
Mojolicious on Steroids
Behat - Drupal South 2018
計算機概論20161205
Desafios do Profissionalismo Ágil
計算機概論20161212
Reno-Tahoe WordCamp 2011 - WordPress End User Security - Dre Armeda
Advanced and Hidden WordPress APIs
Page Caching Resurrected
Evolution of API With Blogging
Web Projects: From Theory To Practice
Php Basic Security
#3 HTML & CSS [know-how]
HTML5 and the web of tomorrow!
Ad

Viewers also liked (20)

PPT
DOCX
Equips de 4 t
PPTX
Headhunting
DOCX
Campionat 4t
DOCX
Equips de 4 t
DOCX
Equips de 4 t
PPT
SlideShare Instant
PPTX
Frame relay
PDF
Marine Navigation
PDF
Python Workshop
PDF
Viet ecosway 1-56
PDF
Internship @SlideShare -My Experiences
PPT
Global_Health_and_Intersectoral_Collaboration
PDF
Pattern Recognition in Clinical Data
PPT
CL 324 PRoj
Equips de 4 t
Headhunting
Campionat 4t
Equips de 4 t
Equips de 4 t
SlideShare Instant
Frame relay
Marine Navigation
Python Workshop
Viet ecosway 1-56
Internship @SlideShare -My Experiences
Global_Health_and_Intersectoral_Collaboration
Pattern Recognition in Clinical Data
CL 324 PRoj
Ad

More from Saket Choudhary (20)

ODP
ISG-Presentacion
ODP
ISG-Presentacion
PPT
gsoc2012demo
PPT
PPT
PPT
PPT
PPT
PPT
Training_Authoring
PPT
Training_Authoring
PPT
Training_Authoring
PPT
Training_Authoring
PPT
Training_Authoring
PPT
Training_Authoring
PPT
Training_Authoring
PPT
Training_Authoring
PPT
Testslideshare1
PPT
Testslideshare1
PPT
Testslideshare1
PPT
Testslideshare1
ISG-Presentacion
ISG-Presentacion
gsoc2012demo
Training_Authoring
Training_Authoring
Training_Authoring
Training_Authoring
Training_Authoring
Training_Authoring
Training_Authoring
Training_Authoring
Testslideshare1
Testslideshare1
Testslideshare1
Testslideshare1

SlideShare Instant

  • 1. Creating SlideShare Instant Demo : http://home.iitb.ac.in/~saket.kumar/slideshare Source: https://github.com/saketkc/SlideShare-Instant t Saket Choudhary http://home.iitb.ac.in/~saket.kumar IIT Bombay
  • 2. What is “Instant”? 1.Get spontaneous results “on the go” while you type. 2.Saves time 3.First results are generally preffered reults hence search the “browsing Example: 1. Google Search Instant(Results appear as you type) 2. YouTube Instant : The thing that actually landd up its creator with a job offer !
  • 3. SlideShare Instant ! Get instant results for your Slide/Document Search ! Not Satisfied with the first result?? Go Click the “Next” button ! Not So Fast Yet ! Well the source code is all open Go edit it ! Just Respect the Open Source Terms: https://github.com/saketkc/SlideShare-Instant Demo available at: http://home.iitb.ac.in/~saket.kumar/slideshare
  • 4. Requirements 1.AJAX calls (Hail Google !) 2.PHP ( My favourite on Web So far ! I am falling in love with RoR though) 3. Javascript(jquery) 4. CSS (Brains with Beauty is the way everyonr likes it ! )
  • 5. Code Snippets <input type=&quot;text&quot; class='search_input' /><br/> Define an “onkeyup” event sen an ajax GET request to 'ajax.php' containing the parameters: the 'ajaxeeequest' and 'query' $(&quot;.search_input&quot;).keyup(function() { var search_input = $(this).val(); var keyword= encodeURIComponent(search_input); $.ajax({ type: &quot;GET&quot;, url: &quot;ajax.php&quot;, data:{'op':'ajaxrequest','query':keyword}, success: function(msg){ $('.inner').html(msg); //fetch the Slide and echo it on the page } }); });
  • 6. Contact Me I am a Sophomore at IIT Bombay as of 2011 . I can be contacted at [email_address]
  • 7. Ajax.php <?php session_start(); $var=array(); global $vaar; //$var=[]; if ($_GET['op']==&quot;ajaxrequest&quot;) {$var=$_GET['query']; $api_key=&quot;8GD14Jk1&quot;; $secret=&quot;mnFaUN4s&quot;; $proxy=&quot;proxy&quot;; $pass=&quot;user:pwd&quot;; $timeout=0; $ts=time(); $hash=sha1($secret.$ts); # use CURL library to fetch remote file $apiurl=&quot;http://www.slideshare.net/api/2/search_slideshows?q=$var&quot;; $ch = curl_init(); curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);
  • 8. curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_PROXYPORT,80); curl_setopt($ch, CURLOPT_PROXYUSERPWD,$pass); $url = $apiurl.&quot;&api_key=$api_key&ts=$ts&hash=$hash&items_per_page=1&quot;; curl_setopt ($ch, CURLOPT_URL, $url); $file_contents = curl_exec($ch); $xml = simplexml_load_string($file_contents); $number=1; foreach ( $xml->Slideshow as $files) { $_SESSION[$var][$number]=$files->Embed; //echo $_SESSION['sad']['2']; $vaar[$number]=$_SESSION[$var][$number]; echo ($vaar[$number]); $number=$number+1; } }
  • 9. if ($_GET['op']==&quot;numberrequest&quot;) { // session_start(); $num=$_GET['number']; $query=$_GET['query']; $api_key=&quot;8GD14Jk1&quot;; $secret=&quot;mnFaUN4s&quot;; $proxy=”proxy” $pass=&quot;user:pwd”; $timeout=0; $ts=time(); $hash=sha1($secret.$ts); # use CURL library to fetch remote file $apiurl=&quot;http://www.slideshare.net/api/2/search_slideshows?q=$query&quot;;
  • 10. $ch = curl_init(); curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_PROXYPORT,80); curl_setopt($ch, CURLOPT_PROXYUSERPWD,$pass); $url = $apiurl.&quot;&api_key=$api_key&ts=$ts&hash=$hash&items_per_page=$num&quot;; curl_setopt ($ch, CURLOPT_URL, $url); $file_contents = curl_exec($ch); //$res = simplexml_load_file($file_contents); $xml = simplexml_load_string($file_contents); $number=1; foreach ( $xml->Slideshow as $files) { $_SESSION[$var][$number]=$files->Embed; $vaar[$number]=$_SESSION[$var][$number]; if ($number==$num) { echo $files->Embed; } $number=$number+1; }} ?>
  • 11. Index.php <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;> <html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;> <head> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /> <LINK href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;> <title>SlideShare Instant</title> <script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;></script> <script src=&quot;http://chrisslidesharehacks.googlecode.com/files/previewer2.js&quot;></script> <script type=&quot;text/javascript&quot;> $(document).ready(function() { var number=01; $(&quot;.search_input&quot;).focus(); $(&quot;.search_input&quot;).keyup(function() { var search_input = $(this).val(); var keyword= encodeURIComponent(search_input); $.ajax({ type: &quot;GET&quot;, url: &quot;ajax.php&quot;, data:{'op':'ajaxrequest','query':keyword}, success: function(msg){ $('.inner').html(msg); } }); });
  • 12. $('#next').click(function() { number=number+1; var keyword = $(&quot;.search_input&quot;).val(); $.ajax({ type: &quot;GET&quot;, url: &quot;ajax.php&quot;, data:{'op':'numberrequest','query':keyword,'number':number}, success: function(msg){ $('.inner').html(msg);//=msg; } }); }); $('#prev').click(function() { number=number-1; var keyword = $(&quot;.search_input&quot;).val();
  • 13. $.ajax({ type: &quot;GET&quot;, url: &quot;ajax.php&quot;, data:{'op':'numberrequest','query':keyword,'number':number}, success: function(msg){ $('.inner').html(msg);//=msg; } }); }); }); </script> <body> <center> SlideShare Instant Query<input type=&quot;text&quot; class='search_input' /><br/> <div class=&quot;container&quot;> <div class=&quot;inner&quot;></div> <button id=&quot;next&quot;> Next--</div> <button id=&quot;prev&quot;>--Prev</div> </div> </center> </body>