Categories
Dev

RSS Feed mit PHP bauen

Disclaimer: This is a new version of my RSS Feed Turorial from 2008, as it still gets a decent amount of traffic from Google. Hope it still helps 15 years later.

Einen RSS Feed kann man kinderleicht für seine dynamische Website, zum Beispiel ein News Script, erstellen. Dafür ist nur die Kenntnis vom Aufbau einer RSS Datei plus eine einfache Datenbankabfrage notwendig. Hier wird gezeigt wie man einen solchen dynamische generierten RSS Feed manuell zusammenstellt.

Einleitung

Als Vorwissen für dieses Tutorial benötigt man Kenntnisse in php und mysql. Ziel ist es ein kleines php Script zu schreiben, das auf Basis von Daten aus einer mysql o.ä. Datenbank dynamisch einen RSS Feed generiert.

Zuerst muss man sich entscheiden auf welchen RSS Standard man zurück greifen will. Es gibt diverse Standards, die man auch gängig bei anderen Seiten finden kann – zB. RSS0.91, RSS1.0 und RSS2.0 (mehr dazu hier). Wir werden in diesem Tutorial einen RSS2.0 Feed erstellen.

Dokument Definition

Als erstes erstellen wir in einem Editor eine leere Datei und fügen folgenden Header Code in die ersten Zeilen ein:

<?xml version="1.0" encoding="ISO-8859-1" ?> 
<rss version="2.0"> 
<channel> 

Hier wird erstmal definiert um was für ein Dokument es sich hier eigentlich handelt bzw. die XML DTD dazu bestimmt. Die Tags “<rss>” und ” <channel>” sind die Basis Element eines RSS Feeds. Da wir einen Dynamischen RSS Feed haben wollen und die erstellende Datei eine php Script beinhaltet, muss die erste Zeile, die XML Definition, mit einem echo ausgegeben werden, da sonst der php Interpretor auf das “?” mit einem Parse Error reagiert.

<?xml version="1.0" encoding="ISO-8859-1" ?>" 

Weiters muss hier dem Browser der content type mitgeteilt werden, da dieser sonst den Inhalt als Html und icht als xml ausgibt. Die ganze veränderte Zeile sieht dann wie folgt aus:

<?php header("Content-type: text/xml"); 
echo "<?xml version="1.0" encoding="ISO-8859-1" ?>"; ?>

Meta Daten

Nachdem wir nun die Stammelemente plus die xml Definition erstellt haben machen wir uns an die Meta Daten des Feeds. Die sehen bei RSS2.0 folgendermaßen aussehen und sind meistens statisch. Die Elemente hier sind selbsterklärend. Beim Tag “lastBuildDate” könnte man zum Beispiel mit <?php $now = time(); echo $now; ?> zur Script Laufzeit das aktuelle Datum einsetzen.

<title>Website name</title>
<link>http://www.beispiel.de</link>
<description>Beschreibung von Website</description>
<language>de-de</language>
<pubDate>Datum der Erstellung</pubDate>
<lastBuildDate>Datum des letzten Outputs, in vielen Fällen die Ausführzeit des Scriptes</lastBuildDate>
<docs>http://www.beispiel.to/rss.php</docs>
<generator>Rss Feed Engine</generator>
<managingEditor>info@beispiel.de</managingEditor>
<webMaster>info@beispiel.de</webMaster>

Elemente

Nun da die Meta Elemente ausgefüllt sind ist der nächste Schritt die einzelnen News Elemente des z.B. News Scipts in RSS konforme Daten zu konvertieren. Die Struktur eines Items sieht dabei so aus. Ein Feed kann beliebig viele Items beinhalten aber es macht Sinn diese auf ca. 10-20 Elemente zu beschränken.

<item>
<title>Beispiel Titel</title>
<link>http://www.beispiel.de/link</link>
<description>Beispiel Beschreibung, Text, Bilder etc. Die Description kann auch einen Excerpt (Auszug) des vollen Beitragtextes enthalten.</description>
<pubDate>Datum der Veröffentlichung des Beitrags</pubDate>
<guid>http://www.beispiel.de/link</guid>
</item>

Dieses Template eines Items füllen wir nun mittels einer Datenbank Abfrage o.ä. mit Daten. Der dazu passende Code könnte z.B. so aussehen:

<?php require('mysql_connect.php'); 
$SqlSelect = "SELECT link, pic, titel, text FROM news LIMIT 0,20"; 
$result = mysql_query($SqlSelect); 
if (!$result) { die('Invalid query: ' . mysql_error()); } 

while ($row = mysql_fetch_assoc($result)) { ?> 
<item> 
<title><?php echo $row['titel']; ?></title> 
<link> <?php echo $row['link']; ?> </link> 
<pubDate> Wenn vorhanden Timestamp des Beitrages, ansonst einfach weg lassen </pubDate> 
<description> <?php echo "<img src=\"".$row['pic']."\"></img></a>"; ?> <?php echo $row['text']; ?> </description> 
</item> <?php } 
mysql_free_result($result); 
mysql_close($dbh); 
?>

Zum Schluss schließen wir noch die beiden Stammelemente channel und rss am Ende des Dokumentes.

</channel>
</rss>

Um jetzt den erstellten Dynamischen RSS Feed auf der Hauptseite einzufügen und ihn für die Browser erkennbar zu machen, muss man foolgende Zeile in den Kopf der Hauptseite schreiben:

<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.beispiel.de/rss.php" />

Hier die fertigen Datei:

<?php header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>"; ?>
<rss version="2.0">
<channel> 
	<title>Website name</title>
	<link>http://www.beispiel.de</link>
	<description>Beschreibung von Website</description>
	<language>de-de</language>
	<pubDate>Datum der Erstellung</pubDate>
	<lastBuildDate>Datum des letzten Outputs, in vielen Fällen die Ausführzeit des Scriptes</lastBuildDate>
	<docs>http://www.beispiel.to/rss.php</docs>
	<generator>Rss Feed Engine</generator>
	<managingEditor>info@beispiel.de</managingEditor>
	<webMaster>info@beispiel.de</webMaster>

<?php
require('mysql_connect.php');

$SqlSelect = "SELECT link, pic, titel, text FROM news LIMIT 0,20";
	$result = mysql_query($SqlSelect);

	if (!$result)	{	    die('Invalid query: ' . mysql_error());	}
	
	while ($row = mysql_fetch_assoc($result))	{
	
?>
	<item>
	<title><?php echo $row['titel']; ?></title>	
	<link>
	<?php echo $row['link']; ?>
	</link>	
	<pubDate>
	Wenn vorhanden Timestamp des Beitrages, ansonst einfach weg lassen
	</pubDate>
	<description>
	<?php echo "<img src=\"".$row['pic']."\"></img></a>"; ?>
	<?php  echo $row['text']; ?>
	</description>
	</item>

<?php
	}
mysql_free_result($result);
mysql_close($dbh);
?>

</channel>
</rss>
Categories
Dev Thinktank

How to create an AI driven content machine for your website

Simple AI tools and the connection of them makes it very easy to create large amounts of content (here in the example text) for your blog, website etc. All tools I used here are free and easy to handle.

Step 1: ask chatgpt to create a list of popular items of any category you are interest in. In my example I asked it for the most popular DOS Games with some data of additional information:

Chatgpt will return you a handy table that you can easily further process. The data is nice, but we need some more text and therefore we are going to query chatgpt for each of the game for a summary. You can do this also in the normal prompt screen, but this would take very long. I am using for this a Google Sheet with the GTP for work plugin, that allows you to use the chatgpt als normal Google Sheet functions.

Step 2: Add some more content in a Google Sheet. When you copy/paste the table it will look something like this:

I already added another column Summary where then we want chatgpt to generate our text for each game. To do that we use a simple function:

After some time the request will be filled with a text comparably to mine:

You can add the details or specifics you want to have in your text. Quick hint on the prompt: chatgpt tends to just end longer texts in the middle of a sentence, so to trick it here tell in the prompt you want a 1.500 word summary and the only the first 750 words should be displayed. With this little tweak you will avoid having cut off texts.

As we are in a Google Sheet, the only thing we have to do now is to extend the function to all other rows below and let chatgpt produce the 100 texts. Having our complete texts we can go the next step and get the data into our wordpress Blog. Doing so we use zapier.

Step 3: Import the data als new content to your wordpress blog. Create a new transfer with your source “Google Sheets” and destination “WordPress Blog”.

In the next step choose the Google Sheet File from the dropdown:

Your WordPress also needs some preparation and you need to install the zapier plugin there, so that the app can communicate properly with the blog system:

Next we need to connect our WordPress blog and enter the credentials:

And then we can put everything together and tell zapier which data to use from the Sheet to create our new blog post (you can also create pages or attachments with images):

You can also use HTML in some fields like the Content to create more advanced entries. For the game example here we could create a little table at the top showing all the additional data we have. In the next step you can then review the full dataset and choose which one zapier should transfer.

Final result: the post in WordPress:

If you have chosen the full 100 dataset you will have 100 new posts in your blog. Some constraints from the zapier/Wordpress connection: As you can also see in the screenshot the plugin uses the old classic editor and not the new block editor. Also there are no links in the posts, which are to add in another step.

To fully automate the flow, create a new Zap from the transfer in zapier and let the process run each time a new row has been added to the Sheet. So all you have to do then, is add the row with the name of a new game and the chatgpt function will create your text and the zapier zap will import it automatically to your blog.

Categories
Life

Über den Karl-Kantner-Steig auf die Rax

Am Wochenende war ich seit langem mal nicht mit dem Bike sondern wie seinerseits zu Fuß im Bergland unterwegs. Es ging auf die Rax, genauer gesagt auf den höchsten Punkt, die Heukuppe. Ausgangspunkt war nicht die Bergstation der Seilbahn, sondern die Preiner Gscheid auf ca. 1000 Meter Sehhöhe. Was dann rechnerisch einen Aufstieg von weiteren 1000 Metern als Aufgabe mit sich brachte. Es gibt im Rax-Gebiete einige schöne und einfache Klettersteige die problemlos von jedermann bewältigt werden können.

Mein Wahl viel auf den Karl-Kantner-Steig. Der ist relativ einfach zu klettern und befindet sich entlang eine Geröllschneise.

Aufstieg:
2:20 Stunden
6,76 km

Abstieg:
1:05 Stunden
5,28 km

Hier ein paar Impressionen vom Aufstieg:

Categories
Life

Datenschutz bei Firmengründung (=Fehlanzeige)

Ich habe im März mein eigenes Unternehmen gegründet und im Zuge des Generierungsprozesses einige interessante Erfahrungen gemacht: nicht dass es ewig dauert (Durchlaufzeit 1 Monat+ bis man seine Tätigkeit aufnehmen kann), man wird binnen kurzer Zeit mit Angeboten etc. von Dritten bombardiert. Da frage mich echt woher kommt das, dass meine Daten von einer behördlichen Stelle für Akquise nach außen gegeben werden. Ich weiß zwar dass es laut DSG erlaubt ist Kalt-Akquise bei Firmenkunden zu betreiben dennoch bin ich einigermaßen schockiert, dass von einer Behörde einfach so rigoros Datensätze an Firmen weiter gereicht werden.

Einem Zufall ist es zu verdanken, dass ich genau weiß welche Behörde das ist. Da jede der Behörden die im Gründungsverfahren beteiligt waren, meine akademischen Titel in einer anderen falschen Reihen folge aufzeichneten, weiß ich genau welche Behörde das Datenleck ist: nämlich die Bezirkshauptmannschaft.

Und folgende Firmen haben die Daten erhalten und haben sich umgehend bei mir gemeldet:

  • KSV 1870
  • Metro
  • Volksbank
  • Erste Bank
  • Wiener Städtische Versicherung
  • GIS

Die GIS klappert jetzt anscheinend auch alle neuen Firmensitze ab um mit dem Argument “jeder Computer mit Internetanschluss ist ein Empfanggerät” hier auch nochmals Gebühren zu kassieren. In meinem Fall da Wohnsitz und Firmensitz ident sind, wollten sie zwei mal kassieren.

Update:

  • druck.at
  • c&c pfeider
Categories
work & projects

Side project: brandeins PDF generator

brand_eins_PDF_Generator_-_2015-03-05_11.55.49

Heute darf ich ein kleines Nachmittags-Projekt vorstellen, das ich vor Kurzem geschnitzt habe. Das Problem das es zu lösen gallt: brandeins ist eines meines Lieblingsmagazine das ich auch gerne mal online lese. Hier ist brandeins eine wahre Freude für den Leser, da alle vergangenen Hefte in einem Archiv angeboten werden – auch als PDF Download von einzelnen Artikeln. Allerdings ist es recht mühsam sich ein ganzes altes Heft oder große Teile davon (sprich mehrere Artikel) in einem Flow durchzulesen.

Deshalb hab ich ein kleines Spider-Script geschrieben, das mit der Eingabe einer Heft-URL aus dem Archiv eine PDF Datei generiert und zum Download zur Verfügung stellt. Der PDF Generator stellt mir also alte brandeins Hefte als eine einzelne Datei zum Gebrauch für E-Reader etc. zur Verfügung.

[Update 06.03]
Habe das Service nach Rücksprache mit dem Rechteinhaber wieder eingestellt.

Categories
Quote

every problem can be solved with the right software

Categories
work & projects

Working on taskblitz.com again

maxbook_screen

Back in 2011 I built a simple task management application for my personal use cause I didn’t want tu use any of the given solutions. Now, 3 years later, I start working again on taskblitz which is the successor of this application. With a lot more features than a simple task management solution and a strong focus on small businesses it is a brand new project and business management software now entering the market. Hope you all enjoy our new product and your life just got easier with our solution.

Categories
Thinktank

How to set up usb tethering with a nexus 5 on windows xp

I really like Google products and how easy they work but trying to get USB tethering working on my Nexus 5 almost drove me crazy: no documentation or wrong one from google, old driver sets. So I am quite sure there are many people out there facing the same issue. So here is how I did it finally:

First of all stick to the official documentation you can find here. You need the driver file tetherxp.inf which is unfortunately not linked in the help file – I dunno why. When you google for the file on the web you will easily find it but it won’t work cause it’s outdated. The thing is that every device needs to be mentioned with the correct device id in the file. Most of the files you find are 2 or more years old, so no nexus 5 device id is included. I modified the tetherxp.inf file in order to make it work:

tetherxp.inf

Rename the file to tetherxp.inf and follow the steps from the official documentation:

  • Follow the steps above to turn on USB tethering for your phone or tablet.
  • Download the following configuration file (tetherxp.inf) to your Windows XP computer. Typically, you can right click on the link and choose “Save As”. (If your browser adds “.html” to the file name, you’ll need to edit the name to remove the .html extension and replace it with “.inf” instead.)
  • Connect your phone or tablet to your computer using a USB cable.
    When Windows XP’s New Hardware Wizard opens, select No, not at this time, then click Next.
  • Select Install from a list or specific location, then click Next.
    Click Browse to browse to the directory where you installed the configuration file you downloaded in Step 1, then click Next.
  • When Windows XP finishes installing the software for Android USB Ethernet/RNDIS, click Finish.
Categories
Thinktank

Warum das wahrscheinlich mein letzter Festivalsommer war

Ich mag Festivals total gerne und fahre seit Jahren auf dergleichen um für kleines Geld möglichst viel Musik zu erleben. Was mir aber gerade in diesem Jahr extrem aufgefallen ist, dass die Festival-Szene immer mehr zu einer Maturareise & Ballermann Szene abdriftet. Und man muss dazu sagen, dass ich nicht auf die klassischen Rock-Festivals fahre, wo Trichtersaufen etc. Standard ist, sondern auf (ehemals Underground) Festivals für elektronische Musik. Es scheint aber so, dass auch die nun schon von der pickeligen Youngster-Partymeute entdeckt worden sind und als Training für kommende Springbreak Europes oder ähnliche geistlose Besäufnisse genutzt werden.

Man kann versuchen dem ganzen aus dem Weg zu gehen – was bleibt einem anderes übrig, aber es hat sich hier definitiv kräftig was verändert. Für die Veranstalter ist es sicher toll, da die Veranstaltungen immer mehr Leute anziehen, nur verunstaltet diese neue Kollegen auch konsequent die Campingplätze, sorgen für schlechte Stimmung und benehmen sich einfach nur vollkommen daneben. Es scheint als ist Dubstep jetzt die Allerweltsmusik der 16 Jährigen und jeder ist sooo Underground wenn er sich Skrillex am Campingplatz ertönent aus Mamis Küchenradio zu einer Trichterladung voll XXX reinzieht. Das hat für mich nichts mit Underground, noch mit sonst einer Musikszene zu tun – das ist einfach nur unterstes Ballermann Niveau. Soll auch Leuten gefallen und ist ja alles legitim, aber warum finde ich solches Verhalten jetzt auch schon auf nicht-mainstream Musik Festivals?

Ich für meinen Teil überlege mir sehr gut, ob ich mir das alles nächstes Jahr nochmals antun will, denn ich rechnen kaum mit einer Verbesserung der Situation. Oder vielleicht fahre ich auch zu den Kollegen auf den Ballermann und verpass ihnen eine Ladung Underground 🙂

Categories
Publications

Results of my master thesis on startup marketing

The work deals with the strategic and operational aspects of marketing in internet-startups. New technologies such as the internet created new potentials for the digital age and enabled new business models to become vital. After the shock of the dotcom bubble this economy gained traction and constantly evolved. Influenced by newly developed startup ecosystems in the German-speaking countries of Europe, there has been a new wave of founding that brought numerous successful internet-startups to existence.

In the understanding of marketing as a comprehensive customer-and market-oriented model of thinking, the work examines which strategic and operational concepts have been applied in successful internet-startups in various stages of their growth. The results give a very realistic picture of corporate practice, which is determined by an intuitive and opportunistic approach in the early stage and an in-creasing professionalization coming with the steady upgrowth.

Four key aspects as potential success factors have been identified from the results:

  • Trial & Error-approach
  • Short time to market
  • Localization of the product/service
  • Scalability of the processes

They have been put together in an impact model that represents the main output of the work:

Modell Startup Marketing_002From the impact model we can conclude the following declarations for the different stages:

Early stage

  • Efficient product development and rapid build-up of the distribution have a positive influence on the time to market.
  • The informal strategy in this phase supports faster product development and thus a shorter time to market.
  • The communication depends on a brand definition and a partially developed product.
  • A faster time to market increases the chances of success (pioneer strategy).
  • The marketing spirit in the organization promotes error tolerance and allows a trial and error approach.
  • Incremental product development and a constant testing of the communication channels leads to better results (trial and error approach).

Later stage

  • A formal strategy supports localization and helps to synchronize the different geographical markets.
  • The formal strategy supports the decentralized organization of the marketing team and can coordinate all activities across the various markets.
  • The Product and the communication activities are required to be adapted to each country to work there efficient (localization).
  • The formalized and decentralized organization leads to scalability.
  • Distribution and communication activities must be scalable.
  • The strategy takes the coordinating role of all activities in order to achieve localization and scalability.
  • Scalability is a prerequisite for an economically growth.

The goal of the work was to identify strategic and operational aspects of marketing that are used in successful internet startups. Splitting again into the to growth stages, we can conclude:

Early stage

  • Opportunistic approach in the early stage.
  • Segmentation and positioning happens as part of a marketing concept.
  • Product development and rapid market entry as the central tasks. 
  • Lack of market research is compensated with customer integration.
  • Communication is the main activity in the marketing mix.
  • Use of various communicative channels.
  • The most important communication channels are online marketing, TV and PR.
  • Marketing as a leadership spirit in the company is promoted by the founders.

Later stage

  • Strategy rather than opportunistic approach.
  • The availability of cash is a key factor in the choice of a growth strategy:
    • Little money available -> bootstrapping
    • A lot of money available -> get big fast
  • scalability of the core processes is crucial for economical success
  • Communication is the key element in the marketing mix
  • Online marketing and search engine marketing are well scalable methods increasingly used
  • Mass media like TV can be used for rapid growth
  • The combination of TV and online marketing has been confirmed for e-commerce as the most effective combination. 
  • Customer lifetime value and CRM are gaining importance. 
  • The product development relies heavily on feedback from the  customers. 
  • A centralized marketing organization is suitable when operating on a few markets that are very similar. 
  • A decentralized marketing organization is suitable for companies with a large number of different markets to ensure a localization. Assistance can offered by a marketing service center.

The results of my work show how marketing is practiced and used in successful internet startups. However, it still requires further quantitative research to examine the success effectiveness of each aspect.

But I hope that I gathered some new insights that will help new and existing startups to optimize their marketing activities.

Download