I am creating a platform that provides print capabilities for the social reading and publishing platform, Scribd.
This will allow any user to print a document on the cloud storage
platform, and pass the ID to the Mimeo Connect Cloud Print Platform.
I want to share each step of the process so that others may take advantage of the code I’m writing.
I went to Scribd and logged into my account, clicked on Developers /
API link on the bottom of their site and applied for an API key. Now
I’m able to make calls against the API.
I went and found the document I wanted to pull, The Future of Reading and Publishing is Social, and grabbed the ID of the document. It is located in the URL right after the /doc/37360086/.
Then using the simplexml_load_file() PHP function I GET the file information using the Scribd API:
$Scribd_API_Key = "[api key]“; $Scribd_Document_ID = “37360086″; $Scribd_URL = “http://api.scribd.com/api?method=print.getPrintInfo&api_key=” . $Scribd_API_Key . “&doc_id=” . $Scribd_Document_ID; $xml = simplexml_load_file($Scribd_URL); $Title = $xml->title; $Download_Link = $xml->download_link; $Page_Count = $xml->page_count; $Height = $xml->height; $Width = $xml->width; $DPI = $xml->dpi;
<rsp stat=”ok”> <download_link>http://documents.scribd.com.s3.amazonaws.com/docs/2kjfqelznknvkv5.pdf?t=1284562355 </download_link> <title> The Future of Reading and Publishing is Social </title> <page_count>4</page_count> <height>792</height> <width>612</width> <dpi>72</dpi> </rsp>
Now I can pull the PDF file and begin using for my cloud print ordering process. Next I will need to proof the document before I can display for the user.