PHP Classes
Icontem

File: ldif2array_example.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of tobozo  >  LDIF 2 Array  >  ldif2array_example.php  
File: ldif2array_example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: LDIF 2 Array
Parse LDIF data into arrays
 

Contents

Class file image Download
<h1>ldif2array examples</h1>
<pre><font color=green>/*
* Example to read LDIF file
* @package ldif2Array
* @author tobozo at phpsecure
* @date 2006-12-13
*/</font></pre><?
error_reporting
(E_ALL);
/*
* Example to read LDIF file
* @package ldif2Array
* @author tobozo
* @date 2006-12-13
*/

require("ldif2array.class.php");

$file "users.ldf";


// Example 1, using filename
$ld = new ldif2array($file,true);

print (
"<h2>Example 1, using filename</h2>");

$code '<?'.'

  require("ldif2array.class.php");
  $file = "users.ldf";
  $ld = new ldif2array($file,true);
  print_r($ld->entries);

'
.'?>';

highlight_string($code);

print (
"<pre><h3>Resulting array : </h3>");
print_r($ld->entries);
print (
"</pre><br>");


$code '<?'.'

  require("ldif2array.class.php");
  $file = "users.ldf";
  $ld = new ldif2array();
  $ld->rawdata = file_get_contents($file);
  if($ld->makeArray()) {
    print_r($ld->getArray());
  }

'
.'?>';

// Example 2, using data

$ld = new ldif2array();
$ld->rawdata file_get_contents($file);

print (
"<h2>Example 2, using data</h2>");

if(
$ld->makeArray()) {
  
highlight_string($code);
  print (
"<pre><h3>Resulting array : </h3>");
  
print_r($ld->getArray());
  print (
"</pre>");
}

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products