Domain EPP

Σε αυτή την περιοχή μπορείτε να βρείτε ή να αναζητήσετε πληροφορίες σχετικές με την PHP

Συντονιστές: WebDev Moderators, Super-Moderators, PHP Moderators

Απάντηση
Άβαταρ μέλους
CyberCr33p
Honorary Member
Δημοσιεύσεις: 3194
Εγγραφή: 06 Νοέμ 1999 01:00
Τοποθεσία: Αθήνα
Επικοινωνία:

Domain EPP

Δημοσίευση από CyberCr33p » 20 Μαρ 2009 18:32

Προσπαθώ να συνδεθώ στο https://devepp.ics.forth.gr:700/epp/proxy χρησιμοποιώντας το παρακάτω αρχείο:

Κώδικας: Επιλογή όλων

<?php

	/*	EPP Client class for PHP, Copyright 2005 CentralNic Ltd
		This program is free software; you can redistribute it and/or modify
		it under the terms of the GNU General Public License as published by
		the Free Software Foundation; either version 2 of the License, or
		&#40;at your option&#41; any later version.

		This program is distributed in the hope that it will be useful,
		but WITHOUT ANY WARRANTY; without even the implied warranty of
		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
		GNU General Public License for more details.

		You should have received a copy of the GNU General Public License
		along with this program; if not, write to the Free Software
		Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
	*/

	/**
	* A simple client class for the Extensible Provisioning Protocol &#40;EPP&#41;
	* @package Net_EPP_Client
	* @version 0.0.3
	* @author Gavin Brown <gavin.brown@nospam.centralnic.com>
	* @revision $Id&#58; Client.php,v 1.8 2007/05/25 09&#58;26&#58;49 gavin Exp $
	*/

	require_once&#40;'PEAR.php'&#41;;

	$GLOBALS&#91;Net_EPP_Client_Version&#93; = '0.0.3';

	/**
	* A simple client class for the Extensible Provisioning Protocol &#40;EPP&#41;
	* @package Net_EPP_Client
	*/
	class Net_EPP_Client &#123;

		/**
		* @var resource the socket resource, once connected
		*/
		var $socket;

		/**
		* Establishes a connect to the server
		* This method establishes the connection to the server. If the connection was
		* established, then this method will call getFrame&#40;&#41; and return the EPP <greeting>
		* frame which is sent by the server upon connection. If connection fails, then
		* a PEAR_Error object explaining the error will be returned instead.
		* @param string the hostname
		* @param integer the TCP port
		* @param integer the timeout in seconds
		* @param boolean whether to connect using SSL
		* @return PEAR_Error|string a PEAR_Error on failure, or a string containing the server <greeting>
		*/
		function connect&#40;$host, $port=700, $timeout=1, $ssl=true&#41; &#123;
			$target = sprintf&#40;'%s&#58;//%s&#58;%d/epp/proxy', &#40;$ssl === true ? 'ssl' &#58; 'tcp'&#41;, $host, $port&#41;;
			if &#40;!$this->socket = @fsockopen&#40;$target, $errno, $errstr, $timeout&#41;&#41; &#123;
				return new PEAR_Error&#40;"Error connecting to $target&#58; $errstr &#40;code $errno&#41;"&#41;;

			&#125; else &#123;
				return $this->getFrame&#40;&#41;;

			&#125;

		&#125;

		/**
		* Get an EPP frame from the server.
		* This retrieves a frame from the server. Since the connection is blocking, this
		* method will wait until one becomes available. If the connection has been broken,
		* this method will return a PEAR_Error object, otherwise it will return a string
		* containing the XML from the server
		* @return PEAR_Error|string a PEAR_Error on failure, or a string containing the frame
		*/
		function getFrame&#40;&#41; &#123;
			if &#40;@feof&#40;$this->socket&#41;&#41; return new PEAR_Error&#40;'connection closed by remote server'&#41;;

			$hdr = @fread&#40;$this->socket, 4&#41;;

			if &#40;empty&#40;$hdr&#41; && feof&#40;$this->socket&#41;&#41; &#123;
				return new PEAR_Error&#40;'connection closed by remote server'&#41;;

			&#125; elseif &#40;empty&#40;$hdr&#41;&#41; &#123;
				return new PEAR_Error&#40;'Error reading from server&#58; '.$php_errormsg&#41;;

			&#125; else &#123;
				$unpacked = unpack&#40;'N', $hdr&#41;;
				$length = $unpacked&#91;1&#93;;
				if &#40;$length < 5&#41; &#123;
					return new PEAR_Error&#40;sprintf&#40;'Got a bad frame header length of %d bytes from server', $length&#41;&#41;;

				&#125; else &#123;
					return fread&#40;$this->socket, &#40;$length - 4&#41;&#41;;

				&#125;
			&#125;
		&#125;

		/**
		* Send an XML frame to the server.
		* This method sends an EPP frame to the server.
		* @param string the XML data to send
		* @return boolean the result of the fwrite&#40;&#41; operation
		*/
		function sendFrame&#40;$xml&#41; &#123;
			fwrite&#40;$this->socket, pack&#40;'N', &#40;strlen&#40;$xml&#41;+4&#41;&#41;.$xml&#41;;

		&#125;

		/**
		* a wrapper around sendFrame&#40;&#41; and getFrame&#40;&#41;
		* @param string $xml the frame to send to the server
		* @return PEAR_Error|string the frame returned by the server, or an error object
		*/
		function request&#40;$xml&#41; &#123;
			$this->sendFrame&#40;$xml&#41;;
			return $this->getFrame&#40;&#41;;
		&#125;

		/**
		* Close the connection.
		* This method closes the connection to the server. Note that the
		* EPP specification indicates that clients should send a <logout>
		* command before ending the session.
		* @return boolean the result of the fclose&#40;&#41; operation
		*/
		function disconnect&#40;&#41; &#123;
			return @fclose&#40;$this->socket&#41;;
		&#125;

	&#125;

?>
Ο δικός μου κώδικας περιέχει:

Κώδικας: Επιλογή όλων

<?php
require&#40;'Client.php'&#41;;

$client = new Net_EPP_Client;
$host = 'devepp.ics.forth.gr';
$port = 700;
$timeout = 10;
$ssl = true;

$greeting = $client->connect&#40;$host, $port, $timeout, $ssl&#41;;

echo $greeting;
?>
Μετά από λίγη ώρα ο browser εμφανίζει το εξής μήνυμα:

connection closed by remote server

Κάποια βοήθεια;

Απάντηση

Επιστροφή στο “PHP Προγραμματισμός”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες