PHP Classes

File: examples/example4_getlink.php

Recommend this page to a friend!
  Classes of Naveed ur Rehman   PHP Megaupload.com Class   examples/example4_getlink.php   Download  
File: examples/example4_getlink.php
Role: Example script
Content type: text/plain
Description: To get direct link of uploaded file
Class: PHP Megaupload.com Class
Manage files and folders megaupload.com accounts
Author: By
Last change:
Date: 12 years ago
Size: 1,760 bytes
 

Contents

Class file image Download
<?php
/******************************************************************************
                     HOW TO USE "PHP MEGAUPLOAD.COM CLASS"
 ******************************************************************************
 Example #2: To get direct link of uploaded file
 ******************************************************************************
       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

 
$fileid = "FCFEY7ZD";
 
$directlink = $megaupload->getlink($fileid);

 echo
"The file $fileid can be downloaded from <a href='$directlink'>$directlink</a>.<br/>";
 echo
"Make sure that you wait for atleast 20-30sec before you click the link.";
}
else
{
 echo
"Error occured while connecting to megaupload.com. May be username and/or password supplied is invalid.";
}

$megaupload->disconnect(); //Disconnect to release everything

?>