IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Script contact MSN, Gmail, Yahoo


Sujet :

Langage PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé Avatar de worldhugo
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    139
    Détails du profil
    Informations personnelles :
    Localisation : France, Marne (Champagne Ardenne)

    Informations forums :
    Inscription : Décembre 2008
    Messages : 139
    Par défaut Script contact MSN, Gmail, Yahoo
    Bonjour,
    j'ai télécharger ce sript pour récupérer les contacts msn, gmail, yahoo : http://sahid.funraill.org/2007/12/04...ahoo-avec-php/
    donc il y a usage.php avec le formulaire et c'est là où les contact s'affiche (au dessus du formulaire) et la page contacts.php qui affiche les contacts sur usage.php.
    Mais je voudrais récupérer les contacts sur une autre page. Comment faire ????
    Je vous donne les 2 pages car j'ai modifier quelqu'un petit truc dessus :
    Usage.php :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
     
    <?php
     
    	// Ferdjaoui Sahid <sahid@funraill.org>
    	// Contacts classe
    	// Usage
     
     
    require ('Contacts.php');
     
    @header ('Content-Type: text/html; charset=utf-8');
     
    try 
    {
    	if (!function_exists ('curl_version'))
    		throw new Exception ("Curl n'est pas install");
     
    	if ($_SERVER['REQUEST_METHOD'] == 'POST')
    		{
    			$user = '';
    			$pass = '';
    			$type = ''; // Gmail, Yahoo, Lycos, MSN, AOL
     
    			$o = Contacts::factory (@$_POST['user'], @$_POST['pass'], @$_POST['type']);
    			$result = $o->getContacts ();
    	 }
    }
    catch (Exception $e)
    {
    	echo $e->getMessage ();
    }
    ?>
    <html>
    <body>
    	<form method="POST">
    		<table>
    			<tr>
    				<td><label for="user">Identifiant : </label></td>
    				<td><input type="text" name="user" id="user"/></td>
    			</tr>
    			<tr>
    				<td><label for="pass">Mot de passe : </label></td>
    				<td><input type="password" name="pass" id="pass"/></td>
    				</tr>
    			<tr>
    				<td><label for="type">Type : </label></td>
    				<td>
    					<select name="type" id="type">
    						<option value="Gmail">Gmail</option>
    						<option value="Yahoo">Yahoo</option>
    						<option value="MSN" selected="selected">MSN</option>
    						<option value="Lycos">Lycos</option>
    						<option value="AOL">AOL</option>
    					</select>
    				</td>
    				</tr>
    			<tr>
    				<td></td>
    				<td><input type="submit"></td>
    			</tr>
    		</table>
    	</form>
     
    </body>
    </html>
    Contacts.php :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
     
    <?php
      /*****************************************************************************
       * @author    : Ferdjaoui Sahid
       * @email     : sahid@funraill.org
       * @blog	: http://sahid.funraill.org
       *
       * @license   : GNU GPL v3
       ****************************************************************************/
     
    	/**
    	 * Contacts Class
    	 ************/
     
     
    class Contacts
    {
      public static $arr_type = array ('Gmail', 'MSN', 'Yahoo', 'Lycos', 'AOL');
     
    	public static function factory ($user, $pass, $type)
    	{
    	  if (in_array ($type, self::$arr_type))
    	    {
    	      $class = "{$type}Decorator";
    	      return new $class ($user, $pass);
    	    }
    	  else throw new Exception ('Invalide type, utilisez : '.implode (", ", self::$arr_type));
    	}
    }
     
     
    class LycosDecorator
    {
    	private $_instance;
    	private $_user;
    	private $_pass;
     
    	public function __construct ($user, $pass) 
    	{
    		require ('libs/importLycos.class.php');
    		$this->_instance = new grabLycos ($user, $pass);
    		$this->_user = $user;
    		$this->_pass = $pass;
    	}
     
    	public function getContacts ()
    	{	
    		$result = array ();
    		if (!is_object ($this->_instance))
    			throw new Exception ("Aucune instance");
    		$contacts = (array) @$this->_instance->getContactList ();
    		$i = 0;
    		foreach ($contacts as $name => $email)
    			{
    				$result[$i]['name'] = $name;
    				$result[$i]['email'] = $email;
    				$i++;
    			}
    		return $result;
    	}
    }
     
     
    class AOLDecorator
    {
    	private $_instance;
    	private $_user;
    	private $_pass;
     
    	public function __construct ($user, $pass) 
    	{
    		require ('libs/importAol.class.php');
    		$this->_instance = new grabAol ($user, $pass);
    		$this->_user = $user;
    		$this->_pass = $pass;
    	}
     
    	public function getContacts ()
    	{	
    		$result = array ();
    		if (!is_object ($this->_instance))
    			throw new Exception ("Aucune instance");
    		$contacts = (array) @$this->_instance->getContactList ();
    		$i = 0;
    		foreach ($contacts as $name => $email)
    			{
    				$result[$i]['name'] = $name;
    				$result[$i]['email'] = $email;
    				$i++;
    			}
    		return $result;
    	}
    }
     
     
     
    class MSNDecorator
    {
    	private $_instance;
    	private $_user;
    	private $_pass;
     
    	public function __construct ($user, $pass) 
    	{
    		require ('libs/importMsn.class.php');
    		$this->_instance = new msn;
    		$this->_user = $user;
    		$this->_pass = $pass;
    	}
     
    	public function getContacts ()
    	{	
    		$result = array ();
    		if (!is_object ($this->_instance))
    			throw new Exception ("Aucune instance");
    		$contacts = (array) @$this->_instance->qGrab ($this->_user, $this->_pass);
    		$i = 0;
    		foreach ($contacts as $contact)
    			{
     
    				$result[$i]['name'] = $contact['1'];
    				$result[$i]['email'] = $contact['0'];
    				echo '<b>Email : </b>'.$result[$i]['email'].'<br>';
    				$i++;
    			}
    }
    }
     
    class YahooDecorator
    {
    	private $_instance;
    	private $_user;
    	private $_pass;
     
    	public function __construct ($user, $pass) 
    	{
    		require ('libs/importYahoo.class.php');
    		$this->_instance = new yahooGrabber ($user, $pass);
    		$this->_user = $user;
    		$this->_pass = $pass;
    	}
     
    	public function getContacts ()
    	{	
    		$result = array ();
    		if (!is_object ($this->_instance))
    			throw new Exception ("Aucune instance Yahoo Grabber");
    		$contacts = (array) @$this->_instance->grabYahoo ();
    		$i = 0;
    		foreach ($contacts as $name => $email)
    			{
    				$result[$i]['name'] = $name;
    				$result[$i]['email'] = $email;
    				$i++;
    			}
    		return $result;
    	}
    }
     
    class GmailDecorator
    {
    	private $_instance;
    	private $_user;
    	private $_pass;
     
    	public function __construct ($user, $pass) 
    	{
    		require ('libs/importGmail.class.php');
    		$this->_instance = new GMailer;
    		$this->_user = $user;
    		$this->_pass = $pass;
    	}
     
    	public function getContacts ()
    	{	
    		$result = array ();
    		if (!is_object ($this->_instance))
    			throw new Exception ("Aucune instance GMailer");
    		$this->_instance->setLoginInfo ($this->_user, $this->_pass, "+1GMT");
    		if ($this->_instance->connect ())
    			{
    				$this->_instance->fetchBox (GM_CONTACT, 'all', '');
    				$snapshot = $this->_instance->getSnapshot (GM_CONTACT);
    				$this->_instance->disconnect ();
    				$i = 0;
    				if (isset ($snapshot->contacts))
    					foreach ($snapshot->contacts as $contact)
    						{
    							$result[$i]['name'] = $contact['name'];
    							$result[$i]['email'] = $contact['email'];
    							$i++;
    						}
    				return $result;
    			}
    		else
    			throw new Exception ('Impossible de se connecter');
    	}
    }
    Merci

  2. #2
    Membre Expert
    Avatar de Thes32
    Homme Profil pro
    Développeur PHP, .Net, T-SQL
    Inscrit en
    Décembre 2006
    Messages
    2 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Développeur PHP, .Net, T-SQL

    Informations forums :
    Inscription : Décembre 2006
    Messages : 2 379
    Par défaut
    salut,

    Mais je voudrais récupérer les contacts sur une autre page. Comment faire ????
    ajoute le chemin dans l'attribut action
    ainsi
    devient
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <form method="POST" action="ta_page.php">

  3. #3
    Membre confirmé Avatar de worldhugo
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    139
    Détails du profil
    Informations personnelles :
    Localisation : France, Marne (Champagne Ardenne)

    Informations forums :
    Inscription : Décembre 2008
    Messages : 139
    Par défaut
    ouai ok merci résulo

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. import contact hotmail gmail yahoo
    Par kamclasse dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 1
    Dernier message: 25/09/2009, 15h38
  2. Script interessant , qui envoi un mail a tout vos contact msn
    Par kekou dans le forum Général Conception Web
    Réponses: 0
    Dernier message: 18/04/2008, 04h28
  3. Ecrire un script pour MSN
    Par shaka84 dans le forum Windows
    Réponses: 1
    Dernier message: 13/05/2006, 20h53
  4. Fenêtre facon contact MSN
    Par Bartuk dans le forum Interfaces Graphiques en Java
    Réponses: 3
    Dernier message: 25/04/2006, 19h09
  5. [Connexion] Ports : MSN, ICQ, Yahoo! ...
    Par StouffR dans le forum Développement
    Réponses: 7
    Dernier message: 26/05/2003, 12h13

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo