DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Extending Java APIs: Add Missing Features Without the Hassle
  • Database Integration Tests With Spring Boot and Testcontainers
  • The SPACE Framework for Developer Productivity
  • Revolutionizing Algorithmic Trading: The Power of Reinforcement Learning

Trending

  • Extending Java APIs: Add Missing Features Without the Hassle
  • Database Integration Tests With Spring Boot and Testcontainers
  • The SPACE Framework for Developer Productivity
  • Revolutionizing Algorithmic Trading: The Power of Reinforcement Learning
  1. DZone
  2. Data Engineering
  3. Databases
  4. Pulling a PDF Using Scribd API and PHP

Pulling a PDF Using Scribd API and PHP

Kin Lane user avatar by
Kin Lane
·
Mar. 24, 11 · News
Like (0)
Save
Tweet
Share
12.32K Views

Join the DZone community and get the full member experience.

Join For Free

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.

My goal is to pull a specific file from the Scribd platform. I need a PDF, and Scribd provides this via the Scribd API.

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;
This call returns an XML response containing relevant file information:
<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.

API PDF PHP

Published at DZone with permission of Kin Lane, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Extending Java APIs: Add Missing Features Without the Hassle
  • Database Integration Tests With Spring Boot and Testcontainers
  • The SPACE Framework for Developer Productivity
  • Revolutionizing Algorithmic Trading: The Power of Reinforcement Learning

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: