Programming and more

Entries Tagged ‘php’

Programmatically Build forms with PHP

I needed a way to programmatically build forms with php so that I can easily print them in any template, so that when I change template I don’t have to copy paste and fix forms all over again. So to solve this I needed some php code to automatically build forms. For me there are […]

How to get alexa rank with PHP

Ok usefull function for many people. After some googling I give you the easiest way to get the alexa rank: <? $url="toolspot.org"; function getAlexa($url) { $xml = simplexml_load_file(’http://data.alexa.com/data?cli=10&dat=snbamz&url=’.$url); $rank=(int)$xml->SD[1]->POPULARITY->attributes()->TEXT; $web=(string)$xml->SD[1]->POPULARITY->attributes()->URL; return $rank; } echo $url." has Alexa Rank ".getAlexa($url);     function alexaRank($domain) { $remote_url = ‘http://data.alexa.com/data?cli=10&dat=snbamz&url=’.trim($domain); $search_for = ‘<POPULARITY URL’; $part=”; if ($handle = […]

How to import .sql file with php

I am writing an MVC framework with php, and a Content Management System on top of it. As part of that MVC Framework I created an automatic module installer. A part of that installation script is to take an SQL file and import it into the database. Unfortunately this isn’t as easy as it sounds. […]