<?php
/******************************************************************************
HOW TO USE "PHP MEGAUPLOAD.COM CLASS"
******************************************************************************
Example #2: To get list of files and folders (of root or sub-folder)
******************************************************************************
Author: Naveed-ur-Rehman
Email: naveed@naveedurrehman.com,
naveed.coder@gmail.com,
naveed.ur.rehman@hotmail.com
Website: http://www.naveedurrehman.com/
******************************************************************************
*/
require_once('../class/megaupload.class.php'); //php megaupload.com class file
require_once('credentials.php'); //Your signing in credentails of megaupload.com account
$megaupload = new megaupload_class(); //Initializing the class
$megaupload->username=$username; //Setting credentails (loaded from credentails.php)
$megaupload->password=$password;
$isconnect = $megaupload->connect(); //Return: 0=trouble, 1=validated and connected
if($isconnect==1)
{
echo "Credentials are verified and you are connected to megaupload.com successfully!<br/>";
//Note: See example2_refreshlist.php for getting file and folder IDs
$offolder = ""; //Blank for root otherwise mention folder id
$list = $megaupload->refreshlist(
$megaupload->FILES_MAXCOUNT, //or you may place some number
$megaupload->FILETYPE_ALL, //See Appendix-A
$megaupload->SORT_NAME, //See Appendix-B
$megaupload->ORDER_ASC, //See Appendix-C
$offolder
);
$list = $megaupload->getlist(); //This holds the last refreshlist() response
echo "<pre>";
print_r($list);
echo "</pre>";
}
else
{
echo "Error occured while connecting to megaupload.com. May be username and/or password supplied is invalid.";
}
$megaupload->disconnect(); //Disconnect to release everything
?>
|