WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : MySpace.com Profile Updater
Categories : PHP, PHP Classes, CURL Click here to Update Your Picture
Ehsan Haque
Date : Oct 08th 2006
Grade : 2 of 5 (graded 5 times)
Viewed : 16754
File : 4510.zip
Images : No Images for this code example.
Search : More code by Ehsan Haque
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

This class is used to add data to existing MySpace.com user profile using PHP cURL. User is authenticated with their login information and data - in form of plain text or HTML code - is saved with the existing profile data. User selects the section of their profile where the data is to be added by this class.

Version 1.0, Created 04/09/2006

Author - Ehsan Haque
Web - http://ehsan.bdwebwork.com/

Bug Fixed & Updated by - MA Razzaque Rupom
Web - http://www.rupom.info

process.php
<?php
 
if ((empty($_POST['email'])) || (empty($_POST['password'])) || (empty($_POST['data'])))
  {
   
header("Location: form.html");
    return
false;
  }
 
  require_once(
"class.MySpace.php");
 
 
$email      = $_POST['email'];
 
$password   = $_POST['password'];
 
$section    = $_POST['section'];
 
$data       = $_POST['data'];
   
 
$myspace    = new MySpace;
 
 
/*
  Set to true if HTTP proxy is required to browse net
    - Setting it to true will require to provide Proxy Host Name and Port number
  */
 
$myspace->isUsingProxy = false;
 
 
// Set the Proxy Host Name
 
$myspace->proxyHost = "";
 
 
// Set the Proxy Port Number
 
$myspace->proxyPort = ""
 
 
// Set the location to save the Cookie Jar File
 
$myspace->cookieJarPath = $_SERVER['DOCUMENT_ROOT'] . "/MySpace/";
 
 
/*
  Execute the Service
    - Require to pass MySpace.com Account Username and Password
  */
 
$execute = $myspace->execService($email, $password, $section, $data);
 
  if (!empty(
$myspace->errorInfo))
  {
    echo
$myspace->errorInfo;
    return
false
  }
 
 
$message  = $myspace->getStatusMessage();
 
  echo
"<script language='javascript'>";
  echo
"alert('" . $message . "')\n";
  echo
"location.href='form.html'";
  echo
"</script>";

?>



class.MySpace.php
<?php

/*--------------------------------------------------------------------------
About the class - class.MySpace.php

  This class is used to add data to existing MySpace.com user profile using
  PHP cURL. User is authenticated with their login information and data
  - in form of plain text or HTML code - is saved with the existing profile
  data. User selects the section of their profile where the data is to be
  added by this class.

Version 1.0, Created 04/09/2006

Author  - Ehsan Haque
Web     - http://ehsan.bdwebwork.com/

Bug Fixed & Updated by - MA Razzaque Rupom
Web     - http://www.rupom.info

License: GPL
--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
Public Variables - Alphabetical List

+ cookieJarPath ----------------  Absolute path to write Cookie file
+ data          ----------------  Data to be added
+ email         ----------------  Email for Login
+ isUsingProxy  ----------------  Specifies if the server is using proxy
+ password      ----------------  Password for Login
+ proxyHost     ----------------  Host address for proxy
+ proxyPort     ----------------  Port number for proxy
+ section       ----------------  Section to add data
--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
Private Variables - Alphabetical List

+ addDataURI          ----------  URL to be used to post data
+ allData             ----------  Existing profile data from MySpace.com
+ cookie              ----------  Set to 1 (true) if cookie is to be used
                                  in header
+ cookieFile          ----------  Temporary cookie file name                                 
+ cookieFileJar       ----------  Temporary file where cookie is saved
+ follow              ----------  Set to 1 (true) if header redirection(s)
                                  are to be performed
+ getDataURI          ----------  URL to retrieve existing data
+ loginURI            ----------  URL for login to MySpace.com
+ postFields          ----------  Set the fields to be sent via POST as name=value
+ proxy               ----------  Proxy server address as host:port
+ referer             ----------  Referer URL used by cURL
+ returnTransfer      ----------  Set to 1 (true) if the output is to
                                  saved in as a string
+ sectionFieldName    ----------  Form field name for selected section
+ showHeader          ----------  Set to 1 (true) if header information
                                  is to be printed in the output
+ statusMsg           ----------  Success or Failure message
+ url                 ----------  URL to be used by cURL
+ userAgent           ----------  User agent used by cURL
+ usePostField        ----------  Set to 1 (true) if any data is
                                  sent via POST
--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
Functions - Alphabetical List
--------------------------------------------------------------------------*/

class MySpace
{
 
/*--------------------------------------------------------------------------
  Public Variables
  --------------------------------------------------------------------------*/
   
  /**
  * MySpace.com Email address for login
  * @public
  * @var string
  */
 
var $email              = "";
 
 
/**
  * MySpace.com Password for login
  * @public
  * @var string
  */ 
 
var $password           = "";

 
/**
  * MySpace.com Section for data addition
  * @public
  * @var string
  */ 
 
var $section            = "";

 
/**
  * Data that is to be added to MySpace.com selected Section
  * @public
  * @var string
  */ 
 
var $data               = "";
     
 
/**
  * Abosolute path to save the cookie
  * Default value is DOCUMENT_ROOT
  * @public
  * @var string
  */
 
var $cookieJarPath      = "";
 
 
/**
  * Specifies if Proxy server required as Gateaway
  * Default value is false
  * @public
  * @var boolean
  */ 
 
var $isUsingProxy       = false;
                         
 
/**                     
  * Proxy host name       
  * @public               
  * @var string         
  */                     
 
var $proxyHost          = "";
                         
 
/**                     
  * Proxy port number     
  * @public               
  * @var int             
  */                     
 
var $proxyPort          = 0;
 
 
/*--------------------------------------------------------------------------
  Private Variables
  --------------------------------------------------------------------------*/
 
  /**
  * URL to Authenticate user on MySpace.com
  * @private
  * @var string
  */
 
var $loginURI           = "http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken=f806380a-c55b-42d1-8535-9508c24d50c5";

 
/**
  * URL to Authenticate user on MySpace.com
  * @private
  * @var string
  */
 
var $addDataURI          = "http://profileedit.myspace.com/Modules/ProfileEdit/Pages/Interests.aspx?fuseaction=profile.interests&MyToken=f9420a7d-1a88-46c7-8dee-5765c85d15ba";

 
/**
  * URL to Authenticate user on MySpace.com
  * @private
  * @var string
  */
 
var $getDataURI          = "http://profileedit.myspace.com/Modules/ProfileEdit/Pages/Interests.aspx?fuseaction=profile.interests&MyToken=f9420a7d-1a88-46c7-8dee-5765c85d15ba";
 
 
/**
  * URL to be used by cURL
  * @private
  * @var string
  */                         
 
var $url                = "";
 
 
/**
  * User agent (used to trick Yahoo!)
  * @private
  * @var string
  */
 
var $userAgent          = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6";
 
 
/**
  * Referer URL (used to trick Yahoo!)
  * @private
  * @var string
  */
 
var $referer            = "http://www.myspace.com";
   
 
/**
  * Specifies whether output includes the header
  * @private
  * @var int
  */
 
var $showHeader         = 0;
 
 
/**
  * Specifies if cURL should follow the redirected URL
  * @private
  * @var int
  */
 
var $follow             = 0;

 
/**
  * Specifies if cURL should save the output to a string
  * @private
  * @var int
  */ 
 
var $returnTransfer     = 1;
 
 
/**
  * Specifies number of post fields to pass
  * @private
  * @var int
  */                         
 
var $usePostField       = 0;

 
/**
  * Specify fields to send via POST method as key=value
  * @private
  * @var string
  */
 
var $postFields         = "";

 
/**
  * All profile data from MySpace.com
  * @private
  * @var array
  */
 
var $allData            = array();

 
/**
  * Specify field name for the selected Section
  * @private
  * @var string
  */
 
var $sectionFieldName   = "";

 
/**
  * File where Cookie is temporarily saved
  * @private
  * @var string
  */                         
 
var $cookieFileJar      = "";

 
/**
  * Cookie File that is read by service process
  * This carries same value as $cookieFileJar
  * @private
  * @var string
  */
 
var $cookieFile         = "";

 
/**
  * Specifies if Cookie is to be in header
  * @private
  * @var int
  */
 
var $cookie             = 0;

 
/**
  * Proxy address as proxy.host:port
  * @private
  * @var string
  */
 
var $proxy              = "";

 
/**
  * Status message as found from the profile update page
  * @private
  * @var string
  */ 
 
var $statusMsg          = "";

 
/*--------------------------------------------------------------------------
  Function Definitions
  --------------------------------------------------------------------------*/
   
  /**
  * Executes the Service
  * @param string $login Username of user's MySpace.com Account
  * @param string $password Password of the user's MySpace.com Account
  * @param string $section Section where user's information will be added
  * @param string $data Data that is to be added to the selected section
  * @return array|false
  */ 
 
function execService($email, $password, $section, $data)
  {
   
$email      = trim($email);
   
$password   = trim($password);
   
    if (empty(
$email))
    {
     
$this->setError("provide_email");
      return
false;
    }
   
    if (empty(
$password))
    {
     
$this->setError("provide_pass");
      return
false;
    }

    if (empty(
$section))
    {
     
$this->setError("select_section");
      return
false;
    }
       
    if (empty(
$data))
    {
     
$this->setError("empty_data");
      return
false;
    }
   
   
$this->email      = $email;
   
$this->password   = $password;
   
$this->section    = $section;
   
$this->data       = $data;
   
   
$this->setSectionFieldName();
   
   
// Instructs to authenticate user on MySpace.com
   
$this->auth       = $this->doAuthentication();
   
    if (
$this->auth)
    {
     
// Adds data to the selected secion
     
$this->doAddData();
    }
   
   
// Unlinks the cookie file
   
$this->unlinkFile($this->cookieFileJar);
  }

 
/**
  * Sets Service URL
  * @return void
  */
 
function setSectionFieldName()
  {
    if (empty(
$this->section))
    {
     
$this->setError("select_section");
      return
false;
    }
   
   
$this->sectionFieldName   = 'ctl00$ctl00$Main$ProfileEditContent$editInterests$';
   
   
// Sets the URL depending on the choosen service
   
switch ($this->section)
    {
      case
'aboutme'      : $this->sectionFieldName   .= "AboutMeText"; break;
 
      case
'liketomeet'   : $this->sectionFieldName   .= "LikeToMeetText"; break;
     
      case
'general'      : $this->sectionFieldName   .= "GeneralText"; break;
     
      case
'music'        : $this->sectionFieldName   .= "MusicText"; break;
     
      case
'movies'       : $this->sectionFieldName   .= "MoviesText"; break;
     
      case
'television'   : $this->sectionFieldName   .= "TelevisionText"; break;
     
      case
'books'        : $this->sectionFieldName   .= "BooksText"; break;
     
      case
'heroes'       : $this->sectionFieldName   .= "HeroesText"; break;
    }
  }
   
 
/**
  * Authenticates user on MySpace.com
  * @return boolean
  */
 
function doAuthentication()
  {
   
// Instructs to initialize cURL session
   
$this->initCurl();
   
   
// Sets the URL for authentication purpose
   
$this->url              = $this->loginURI;
   
   
// Sets the number of fields to send via HTTP POST
   
$this->usePostField     = 1;
   
   
// Sets the fields to be sent via HTTP POST as key=value
   
$this->postFields       = "email=$this->email&password=$this->password&ctl00$Main$SplashDisplay$login$loginbutton=&Remember=";
   
   
$this->follow = 1;
   
   
// Instructs to set Cookie Jar
   
$this->setCookieJar();

   
// Checks if the cURL options are all set properly
   
if ($this->setCurlOption())
    {
     
// Instructs to execute cURL session
     
$this->execCurl();

     
// Checks if any cURL error is generated
     
if ($this->getCurlError())
      {
       
$this->unlinkFile($this->cookieFileJar);
       
$this->setError("curl_error");
        return
false;
      }

     
// Checks if the authentication failed, either invalid login or username is not registered
     
if (preg_match("/Must Be Logged-In/i", $this->outputContent))
      {
       
// Instructs to close cURL session
       
$this->closeCurl();
       
       
// Unlinks the cookie file
       
$this->unlinkFile($this->cookieFileJar);
       
       
$this->setError("invalid_login");
        return
false;
      }
     
     
$this->closeCurl();
    }
   
    unset(
$this->outputContent);
   
    return
true;
  }
 
 
/**
  * Adds the profile data on MySpace.com
  * @return array|false
  */
 
function doAddData()
  {
   
$this->getAllData();
   
    if (empty(
$this->allData))
    {
     
$this->setError("profile_data_empty");
      return
false;
    }
   
   
$this->initCurl();
   
$this->url              = $this->addDataURI;
   
$this->referer          = "http://profileedit.myspace.com/index.cfm?fuseaction=profile.interests&MyToken=a0ef3ff6-5b8c-4d7b-9fdb-38c2e5df01f5";
   
   
$this->usePostField     = 1;
   
   
$this->header           = 0;
   
    foreach (
$this->allData as $key => $value)
    {
     
     
$addValue = ($key == $this->sectionFieldName) ? stripslashes($this->data).$value : $value;
           
     
$addValue  = urlencode($addValue);     
     
     
$postFields[]         = "$key=$addValue";
    }
   
   
$this->postFields       = implode("&", $postFields);
   
   
$this->cookieFile       = $this->cookieFileJar;

   
$this->follow           = 0;
   
    if (
$this->setCurlOption())
    {
     
$this->execCurl();

     
// Pattern to match the confirmation message
     
$pattern      = "/profile\supdated/i";
     
     
preg_match($pattern, $this->outputContent, $match);
     
      if (!empty(
$match))
      {
       
$this->setStatusMessage(true);
      }
      else
      {
       
$this->setStatusMessage(false);
      }
                 
     
$this->closeCurl();
     
      return
true;     
    }
   
    return
false;   
  }

 
/**
  * Gets the profile data from MySpace.com
  * @return array|false
  */
 
function getAllData()
  {
   
$this->initCurl();
   
$this->url              = $this->getDataURI;
   
$this->referer          = "http://profileedit.myspace.com/index.cfm?fuseaction=profile.interests&MyToken=6f4851ca-a9bc-43de-bde7-4991ec305c0c";
   
$this->header           = 0;   
   
$this->cookieFile       = $this->cookieFileJar;
   
$this->follow           = 0;
   
    if (
$this->setCurlOption())
    {
     
$this->execCurl();
     
     
// Searching for HIDDEN INPUT tags
     
$patternHiddens   = "/\<input+.+hidden+.+>/iU";
     
preg_match_all($patternHiddens, $this->outputContent, $matchHiddens);
     
      if (!empty(
$matchHiddens[0]))
      { 
       
// Processing HIDDEN INPUT tags as name = value
       
foreach ($matchHiddens[0] as $key => $value)
        {
         
$patterForName    = "/name=\"\S*\"/iU";
         
preg_match($patterForName, $value, $matchName);
         
$refinedName = str_replace("\"", "", str_replace("name=", "", $matchName[0]));
     
         
$patterForValue   = "/value=\"\S*\"/iU";
         
preg_match($patterForValue, $value, $matchValue);
         
$refinedValue = str_replace("\"", "", str_replace("value=", "", $matchValue[0]));
             
          if ((
preg_match("/VIEWSTATE/i", $refinedName)) || (preg_match("/hash/iU", $refinedName)))
          { 
           
$result[$refinedName] = $refinedValue;
          }
        }
      }

     
// Searching for SUBMIT INPUT tags
     
$patternSubmits   = "/\<input+.+submit+.+>/iU";
     
preg_match_all($patternSubmits, $this->outputContent, $matchSubmits);
     
      if (!empty(
$matchSubmits[0]))
      { 
       
// Processing SUBMIT INPUT tags as name = value
       
foreach ($matchSubmits[0] as $key => $value)
        {
         
$patterForName    = "/name=\"\S*\"/iU";
         
preg_match($patterForName, $value, $matchName);
         
$refinedName = str_replace("\"", "", str_replace("name=", "", $matchName[0]));
     
         
$patterForValue   = "/value=\".*?\"/iU";
         
preg_match($patterForValue, $value, $matchValue);
         
$refinedValue = str_replace("\"", "", str_replace("value=", "", $matchValue[0]));
             
          if (
preg_match("/save/iU", $refinedValue))
          { 
           
$result[$refinedName] = $refinedValue;
          }
        }
      }
       
     
// Searching for TEXTAREA tags
     
$this->outputContent = preg_replace("/\<br>\<\/textarea>/iU","",$this->outputContent);
     
$patternTAs       = "/\<textarea.+>.*\<\/textarea>/iU";
     
preg_match_all($patternTAs, $this->outputContent, $matchTAs);
     
      if (!empty(
$matchTAs[0]))
      {
       
// Processing TEXTAREA tags as name = value
       
foreach ($matchTAs[0] as $key => $value)
        {
         
$patterForName    = "/name=\"\S*\"/iU";
         
preg_match($patterForName, $value, $matchName);
         
$refinedName = str_replace("\"", "", str_replace("name=", "", $matchName[0]));
         
         
$patterForValues  = "/\<textarea.+>.*\<\/textarea>/iU";
         
preg_match($patterForValues, $value, $matchValue);
         
         
$replacePattern = array (
                                 
'/<textarea.+\">/iU',
                                 
'/<\/textarea>/iU'
                                 
);
         
$replaceText    = array (
                                 
'',
                                 
''
                                 
);
                                 
         
$refinedValue = preg_replace($replacePattern, $replaceText, $matchValue[0]);
         
         
         
$result[$refinedName] = $refinedValue;
         
        }
      }
     
     
$this->closeCurl();
     
     
$this->allData = $result;

      return
true;
    }
   
    return
false;   
  }
 
 
/**
  * Initializes cURL session
  * @return void
  */ 
 
function initCurl()
  {
   
$this->curlSession    = curl_init();
  }

 
/**
  * Sets the Cookie Jar File where Cookie is temporarily saved
  * @return void
  */
 
function setCookieJar()
  {
   
// Sets the encrypted cookie filename using MySpace.com account username
   
$this->cookieFilename = MD5($this->email);
   
   
// Sets the Cookie Jar filename with an absolute path
   
$this->cookieFileJar  = (!empty($this->cookieJarPath)) ? $this->cookieJarPath . "/" . $this->cookieFilename : $_SERVER['DOCUMENT_ROOT'] . "/" . $this->cookieFilename;
   
   
fopen($this->cookieFileJar, "w");
  }
 
 
/**
  * Sets cURL options
  * @return boolean
  */ 
 
function setCurlOption()
  {
   
// Sets the User Agent 
   
curl_setopt($this->curlSession, CURLOPT_USERAGENT, $this->userAgent);
   
   
// Sets the HTTP Referer
   
curl_setopt($this->curlSession, CURLOPT_REFERER, $this->referer);
   
   
// Sets the URL that PHP will fetch using cURL
   
curl_setopt($this->curlSession, CURLOPT_URL, $this->url);
   
   
// Sets the number of fields to be passed via HTTP POST
   
curl_setopt($this->curlSession, CURLOPT_POST, $this->usePostField);
   
   
// Sets the fields to be sent via HTTP POST as key=value
   
curl_setopt($this->curlSession, CURLOPT_POSTFIELDS, $this->postFields);
   
   
// Sets the filename where cookie information will be saved
   
curl_setopt($this->curlSession, CURLOPT_COOKIEJAR, $this->cookieFileJar);
   
   
// Sets the filename where cookie information will be looked up
   
curl_setopt($this->curlSession, CURLOPT_COOKIEFILE, $this->cookieFile);
   
   
curl_setopt($this->curlSession, CURLOPT_HEADER, $this->header);
   
   
// Sets the option to set Cookie into HTTP header
   
curl_setopt($this->curlSession, CURLOPT_COOKIE, $this->cookie);
   
//curl_setopt($this->curlSession, CURLOPT_SSL_VERIFYPEER,false);
    // Checks if the user needs proxy (to be set by user)
   
if ($this->isUsingProxy)
    {
     
// Checks if the proxy host and port is specified
     
if ((empty($this->proxyHost)) || (empty($this->proxyPort)))
      {
       
$this->setError("proxy_required");
       
$this->unlinkFile($this->cookieFileJar);
        return
false;
      }
     
     
// Sets the proxy address as proxy.host:port
     
$this->proxy          = $this->proxyHost . ":" . $this->proxyPort;
    }
       
   
// Sets the proxy server as proxy.host:port
   
curl_setopt($this->curlSession, CURLOPT_PROXY, $this->proxy);
   
   
// Specifies whether to save the output to a string
   
curl_setopt($this->curlSession, CURLOPT_RETURNTRANSFER, $this->returnTransfer);
   
curl_setopt($this->curlSession, CURLOPT_CAINFO, $this->caBundleFile);
   
// Specifies whether to use all header redirections
   
curl_setopt($this->curlSession, CURLOPT_FOLLOWLOCATION, $this->follow);
   
    return
true;
  }
 
 
/**
  * Executes cURL Session
  * @return void
  */ 
 
function execCurl()
  {
   
$this->outputContent    = curl_exec($this->curlSession); 
  }

 
/**
  * Closes cURL session
  * @return void
  */ 
 
function closeCurl()
  {
   
curl_close($this->curlSession);
    unset(
$this->curlSession);
  }

 
/**
  * Sets the either success/failure message
  * @return void
  */ 
 
function setStatusMessage($status = null)
  {
   
$this->statusMsg = ($status) ? "Profile updated successfully" : "Profile was not updated";
  }

 
/**
  * Returns the status message
  * @return string
  */ 
 
function getStatusMessage()
  {
    return
$this->statusMsg
  }
 
 
/**
  * Unlinks any given file
  * @return void
  */ 
 
function unlinkFile($fileToUnlink)
  {
    if (
file_exists($fileToUnlink))
    {
     
unlink($fileToUnlink);
    }
  }

 
/**
  * Sets any cURL error generated
  * @return boolean
  */ 
 
function getCurlError()
  {
   
$this->curlError    = curl_error($this->curlSession);
   
    return (!empty(
$this->curlError)) ? true : false;
  }
 
 
/**
  * Sets Error Information
  * @return void
  */ 
 
function setError($error)
  {
   
$msg  = (!empty($error)) ? $this->getErrorInfo($error) : null;
   
$this->errorCount++;
   
$this->errorInfo = $msg;
  }

 
/**
  * Provides the Error message
  * @param string $error Error code for which error message is generated
  * @return string
  */ 
 
function getErrorInfo($error)
  {
    switch (
$error)
    {
      case
'provide_service'    : $msg  = "Must specify a Service"; break;
     
      case
'provide_email'      : $msg  = "Must provide Email address"; break;
                               
      case
'provide_pass'       : $msg  = "Must provide Password"; break;
     
      case
'select_section'     : $msg  = "Must select Section"; break;
     
      case
'profile_data_empty' : $msg  = "Could not retrieve Profile Data"; break;
     
      case
'empty_data'         : $msg  = "Must provide Data to add"; break;
                               
      case
'proxy_required'     : $msg  = "Must provide both Proxy host and port"; break;
                               
      case
'invalid_login'      : $msg  = "Login information incorrect"; break;
                               
      case
'curl_error'         : $msg  = $this->curlError; break;
    }
   
    return
$msg;
  } 
}

?>




form.html
<html>
  <head>
    <title>Add Data to MySpace.com Profile</title>
    <style media="screen" type="text/css">
      TABLE {
        border: 1px solid #000000;
      }
     
      TD {
        font-family: Verdana, Arial;
        font-size: 11px;
        font-weight: bold;
      }
     
      INPUT {
        font-family: Verdana, Arial;
        font-size: 11px;
        font-weight: normal;
        border: 1px solid #999999;   
      }

      SELECT {
        font-family: Verdana, Arial;
        font-size: 11px;
        font-weight: normal;
        border: 1px solid #999999;   
      }
     
      TEXTAREA {
        font-family: Verdana, Arial;
        font-size: 11px;
        font-weight: normal;
        border: 1px solid #999999;   
      }     
           
      #head {
        font-size: 15px;
        font-weight: normal;
        color: #FFFFFF;
        background: #000000;
      }
    </style>
  </head>
 
  <body>
   
    <table align="center" width="40%" border="0" cellpadding="5" cellspacing="0">
    <form action="process.php" method="POST">
     
      <tr>
        <td align="center" id="head">
          MySpace.com Login
        </td>
      </tr>
      <tr>
        <td>
          Email
          <br>
          <input type='text' size='35' name='email'>
        </td>
      </tr>
      <tr>
        <td>
          Password
          <br>
          <input type='password' size='35' name='password'>
        </td>
      </tr>
      <tr>
        <td>
          Section
          <br>
          <select name='section'>
            <option value='aboutme'>About Me</option>
            <option value='liketomeet'>Like to Meet</option>
            <option value='general'>General</option>
            <option value='music'>Music</option>
            <option value='movies'>Movies</option>
            <option value='television'>Television</option>
            <option value='books'>Books</option>
            <option value='heroes'>Heroes</option>
          </select>
        </td>
      </tr>
      <tr>
        <td align="center">
          <div align="left">Text or HTML Code that you want to add</div>
          <br>
          <textarea cols='55' rows='15' name='data'></textarea>
        </td>
      </tr>     
      <tr>
        <td align="center">
          <input type="submit" name="submitButton" value="Process Data">
        </td>
      </tr>
     
    </form>
    </table>
       
  </body>
</html>



Returns Yahoo! Address Book and Messenger List as an Array
Categories : PHP, PHP Classes, CURL
Link Manager for Link Exchangers
Categories : PHP, PHP Classes, Databases, MySQL, CURL
These PHP Classes Check if a host is alive using various methods.
Categories : PHP, PHP Classes, Sockets, CURL
Url To Pdf Report By Remote Application
Categories : PHP, PHP Classes, PDF, CURL
ADODB Database Wrapper Abstraction Library for PHP: MySQL, MSSQL, Oracle, Interbase,ODBC, Microsoft Access and FoxPro.
Categories : PHP Classes, Databases, PHP, General SQL, ODBC
This class splits the results of the query into multiple pages like what the search engine does.
Categories : PHP Classes, PHP, MySQL, Databases
Automatic generation of HTML code for a table. OO interface. Can define colspan, rowspan, table style, cell style, and data style. Simple, but effective.
Categories : PHP, PHP Classes, HTML, HTML and PHP
Expose - PHP template engine, supports server and client-sided caching,a plugin system, multiple languages, template script language is based on PHP itself.
Categories : PHP, PHP Classes, Templates, Complete Programs
A class for sending email; it has support for To:, Cc:, Bcc: and Reply-To: headers. It requires that you have sendmail installed.
Categories : Email, PHP Classes, PHP
Image Cache
Categories : Graphics, PHP Classes, PHP
Create and restore backup of MySQL databases
Categories : MySQL, Databases, PHP, PHP Classes, Complete Programs
XML Menu
Categories : PHP, PHP Classes, Navigation, XML, XSL
A very basic and fast XML parser
Categories : PHP, PHP Classes, XML
Class: Info on Users, Servers and the running script
Categories : PHP, Classes and Objects, User Interface, PHP Classes
PHP MIME Decoder. This class decodes Mime Encoded email message. Attachments are stored in a director. Works with Multipart/alternative, multipart/mixed etc. see http://p3mail.com for example.
Categories : PHP, PHP Classes, Email