How To View Document from a url using scribd api

47 views
Skip to first unread message

Rauniz Dm

unread,
May 1, 2015, 6:49:48 PM5/1/15
to scribd-platfo...@googlegroups.com
Hello ,

I have successfully uploaded the document to the scribd website , now i need that document to be able to view , but the problem is if i pass the values of the doc id and access key in the javascript it does not show anything but when i pass the static doc id and access key it shows that particular doc.

here is the code please help me its very urgent :

<?php

require_once 'scribd.php';

$scribd_api_key = "zkmgrnfjsgyvowa4z1m3rjnzbd2qog";
$scribd_secret = "sec-qwa7qtp3owul1bp853i4i2yxt0"; 

$scribd = new Scribd($scribd_api_key, $scribd_secret);




 /* Upload a document from a file*/


$file = 'demo.txt'; //a reference to the file in reference to the current working directory.
$doc_type = null;
$access = null;
$rev_id = null;
$data = $scribd->upload($file, $doc_type, $access, $rev_id); 
$doc_id = $data['doc_id'];
$access_key= $data['access_key'];
?>
<html>
<head>
<title> yoyo</title>

<script type="text/javascript" src='http://www.scribd.com/javascripts/scribd_api.js'></script>


<script type='text/javascript'>
  var scribd_doc = scribd.Document.getDoc($doc_id, '$access_key');  // i have passed the variable heres but it never shows anything
 var scribd_doc = scribd.Document.getDoc(263807370, 'key-8fcJkDuIOHdGAuRkn0Zu');  // this one works do not what is the issue
  var onDocReady = function(e){
  // scribd_doc.api.setPage(3);
  }

       scribd_doc.addParam("jsapi_version",2);
     scribd_doc.addParam("public", false);
     scribd_doc.addParam("mode", "slideshow");
     scribd_doc.addParam("auto_size", true);
     scribd_doc.addParam("disable_related_docs", true);
     scribd_doc.addParam("title", "179329-preview");
     scribd_doc.write('embedded_doc');
</script>
</head>
<body>


<div id='embedded_doc'><a href='http://www.scribd.com'>Scribd</a></div>


</body>
</html>


Please comments needed

Reply all
Reply to author
Forward
0 new messages