Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1


Ratings: (0)|Views: 0|Likes:
Published by Lari Lohikoski

More info:

Published by: Lari Lohikoski on Nov 14, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





<?php/*** Examples* This file gives a number of working examples for the PHP Client Library* To use them, first enter your API key and Secret in this file* Then, uncomment one of the examples and execute the file in Apache*/require_once 'scribd.php';$scribd_api_key = "ENTER-YOUR-API-KEY-HERE";$scribd_secret = "ENTER-YOUR-API-SECRET-HERE";$scribd = new Scribd($scribd_api_key, $scribd_secret);/*** Upload a document from a file*/$file = '../testfile.txt'; //a reference to the file in reference to the current workingdirectory.$doc_type = null;$access = null;$rev_id = null;// $data = $scribd->upload($file, $doc_type, $access, $rev_id); // returns Array ( [doc_id] =>1026598 [access_key] => key-23nvikunhtextwmdjm2i )/*** Upload a document from a URL*/$scribd->my_user_id = '143'; # The user ID of one of your users$url = 'http://lib.store.yahoo.net/lib/paulgraham/onlisp.ps';$doc_type = null;$access = "public";$rev_id = null; // By using a id stored in a database, you can update an existing documentwithout creating a new one// $data = $scribd->uploadFromUrl($url, $doc_type, $access, $rev_id); // returns Array( [doc_id] => 1021237 [access_key] => key-dogbmich9x5iu09kiki )//$data = $scribd->getList(); // returns/*will returnArray([result] => Array([doc_id] => 1018558[access_key] => key-1s79um0eg9a355arn5sb[title] => dxva sig 68744[description] =>[conversion_status] => DONE)[..cut for brevity..][result 40] => Array([doc_id] => 1021237[access_key] => key-dogbmich9x5iu09kiki[title] => onlisp[description] =>
[conversion_status] => PROCESSING))*/$doc_id = "1021237";//$data = $scribd->getConversionStatus($doc_id); // returns PROCESSING/*** Get settings (various meta-information) of a document*/$doc_id = "1026450";//$data = $scribd->getSettings($doc_id); // returns Array ( [doc_id] => 1021237 [title] =>onlisp [description] => [access] => public [license] => by-nc [tags] => [show_ads] => default[access_key] => key-dogbmich9x5iu09kiki )$doc_ids = array("1026450"); // This dosen't HAVE to be an array, im simply demonstrating thatit can be done with one.$title = "New, Updated Title 2";$description = "Updated Description";$access = "private";$license = "pd"; //public domain.. c for normal copyright.. ect.$parental_advisory = "adult";$show_ads = "false"; // setting this to "default" will use the configured option in youraccount$tags = "tag, another tag, another tag"; //You can also use an array here//$data = $scribd->changeSettings($doc_ids, $title, $description, $access, $license,$parental_advisory, $show_ads, $tags); //returns 1/*** Delete a document*/$doc_id = "1024559";//$data = $scribd->delete($doc_id); //returns 1/*** Login as a user*/$username = "aeinstein3";$password = "whitehair";//$data = $scribd->login($username, $password); // Array ( [session_key] =>sess-1d9t8wze460fbhp7jw0p [user_id] => 195134 [username] => aeinstein3 [name] => )/*** Create a new Scribd account*/

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->