<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=PHP_-_FTP_import</id>
	<title>PHP - FTP import - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=PHP_-_FTP_import"/>
	<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=PHP_-_FTP_import&amp;action=history"/>
	<updated>2026-05-09T09:49:44Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Wikizone</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.stephanschlegel.de/index.php?title=PHP_-_FTP_import&amp;diff=23796&amp;oldid=prev</id>
		<title>37.49.72.8: Die Seite wurde neu angelegt: „Beispiel Gesundheitsregion (TYPO3)  &lt;syntaxhighlight lang=&quot;php&quot;&gt; function getRemoteFile($myFile,$myUser,$myPass){ 		/*Reads the file content into $this-&gt;arrLin…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=PHP_-_FTP_import&amp;diff=23796&amp;oldid=prev"/>
		<updated>2019-04-11T13:26:14Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „Beispiel Gesundheitsregion (TYPO3)  &amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; function getRemoteFile($myFile,$myUser,$myPass){ 		/*Reads the file content into $this-&amp;gt;arrLin…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Beispiel Gesundheitsregion (TYPO3)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function getRemoteFile($myFile,$myUser,$myPass){&lt;br /&gt;
		/*Reads the file content into $this-&amp;gt;arrLines*/&lt;br /&gt;
&lt;br /&gt;
		// check if ftp&lt;br /&gt;
		//debug(substr($myFile,0,3));&lt;br /&gt;
		if(substr($myFile,0,6) == &amp;#039;ftp://&amp;#039;){&lt;br /&gt;
			$pathParts = explode(&amp;#039;/&amp;#039;,$myFile,4);&lt;br /&gt;
			debug($pathParts,&amp;quot;Path Parts&amp;quot;);&lt;br /&gt;
			$ftp_server = $pathParts[2];&lt;br /&gt;
			$sourceFile = $pathParts[3];&lt;br /&gt;
			//$targetFile = &amp;quot;tempCsv.csv&amp;quot;;&lt;br /&gt;
			//debug(t3lib_div::getFileAbsFileName(&amp;#039;uploads/gbimporter/&amp;#039;),&amp;quot;DIR&amp;quot;);&lt;br /&gt;
			//$targetFile = $_SERVER[&amp;#039;DOCUMENT_ROOT&amp;#039;].&amp;#039;/temp/tempCsv.csv&amp;#039;;&lt;br /&gt;
			$targetFile = t3lib_div::getFileAbsFileName(&amp;#039;uploads/tx_gbimport/&amp;#039;).&amp;#039;tempCsv.csv&amp;#039;;&lt;br /&gt;
			// Connection&lt;br /&gt;
			$conn_id = ftp_connect($ftp_server);&lt;br /&gt;
			$login_result = ftp_login($conn_id, $myUser, $myPass);&lt;br /&gt;
			if(! $login_result){&lt;br /&gt;
				debug($pathParts,&amp;quot;FTP Verbindung gescheitert !&amp;quot;);&lt;br /&gt;
				$this-&amp;gt;messages[] = &amp;#039;&amp;lt;br&amp;gt;FTP Verbindung gescheitert !&amp;#039;;&lt;br /&gt;
				continue;&lt;br /&gt;
			}&lt;br /&gt;
			debug(ftp_pwd($conn_id),&amp;quot;FTP Verbindung erfolgreich&amp;quot;);&lt;br /&gt;
			$this-&amp;gt;messages[] = &amp;#039;&amp;lt;br&amp;gt;FTP Verbindung erfolgreich !&amp;#039;;&lt;br /&gt;
			// GET FILE&lt;br /&gt;
			ftp_pasv($conn_id,true);&lt;br /&gt;
			$ftpSuccess = ftp_get($conn_id,$targetFile,$sourceFile,FTP_ASCII);&lt;br /&gt;
			if($ftpSuccess) $this-&amp;gt;messages[] = &amp;#039;&amp;lt;br&amp;gt;FTP Datei geladen&amp;#039;;&lt;br /&gt;
			else {&lt;br /&gt;
				$this-&amp;gt;messages[] = &amp;#039;&amp;lt;br&amp;gt;FTP Datei nicht erstellt !&amp;lt;br&amp;gt;&amp;#039;;&lt;br /&gt;
			}&lt;br /&gt;
			/*ob_start();&lt;br /&gt;
			$ftpSuccess = ftp_get($conn_id,&amp;quot;php://output&amp;quot;, &amp;quot;dtregionna.csv&amp;quot;, FTP_BINARY);&lt;br /&gt;
			$csvData = ob_get_contents();&lt;br /&gt;
			ob_end_clean();&lt;br /&gt;
			debug($csvData,&amp;quot;CSV&amp;quot;);*/&lt;br /&gt;
&lt;br /&gt;
			//debug($ftpSuccess, &amp;quot;FTP Download:&amp;quot;);&lt;br /&gt;
			ftp_close($conn_id);&lt;br /&gt;
			$fullPath = $targetFile;&lt;br /&gt;
		}else{ // HTTP download&lt;br /&gt;
			if(!empty($myUser)){// include authentication data&lt;br /&gt;
				$fullPath=str_replace(&amp;quot;http://&amp;quot;, &amp;quot;http://$myUser:$myPass@&amp;quot;,$myFile);&lt;br /&gt;
			}else{&lt;br /&gt;
				$fullPath = $myFile;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		//debug($fullPath,&amp;quot;fullPath&amp;quot;);&lt;br /&gt;
		$row = 0;&lt;br /&gt;
		if($handle = fopen($fullPath, &amp;quot;r&amp;quot;)){&lt;br /&gt;
//...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>37.49.72.8</name></author>
	</entry>
</feed>