First, you’ll want to add the extra repositories to Ubuntu’s sources.list file. From a command shell, you will run the following commands: sudo apt-get install apache2 sudo apt-get install php5 sudo apt-get install libapache2-mod-php5 sudo /etc/init.d/apache2 restart
Month: June 2012
Repositories on Ubuntu are the locations that you can download software from. As a general rule, the default repositories don’t contain the right locations for most software packages that you’ll want to install. You will want to open up the /etc/apt/sources.list file, find and uncomment the following lines deb http://us.archive.ubuntu.com/ubuntu dapper universe main restricted universe deb … Continue reading Adding extra Repositories on Ubuntu
Open a terminal window, and use the following command: sudo apt-get install mysql-server If you are running PHP you will also need to install the php module for mysql 5: sudo apt-get install php5-mysql To create a new database, use the mysqladmin command: mysqladmin create <databasename>
$("iframe").contents().find("#someDiv"); but this will give you the error "Unsafe JavaScript attempt to access frame"
// import XML class App::uses('Xml', 'Utility'); // your XML file's location /*w is the code of the city, and u is the unit of temperature (c/f) $xml = Xml::build('http://weather.yahooapis.com/forecastrss?w=615702&u=c'); $xml should contain the following data, where you can extract whatever you want from it SimpleXMLElement Object ( [@attributes] => Array ( [version] => 2.0 ) … Continue reading Using Yahoo Weather API to get weather conditions in CakePHP2
It is very easy to parse XML in CakePHP , here is an example in CakePHP v2 // import XML Utility class App::uses('Xml', 'Utility'); // your XML file's location $xml1 = Xml::build('http://url-of-XML'); $xml2 = Xml::build('http://http://url-of-XML', array('return' => 'simplexml')); // $xml now is a instance of SimpleXMLElement // New method using DOMDocument $xml3 = Xml::build('http://url-of-XML', array('return' … Continue reading Parsing XML easily in CakePHP 2
example of simple crawling of web pages using client URL (cURL) $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "http://www.example-url.com"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $content= curl_exec($curl); curl_close($curl); var_dump($content); //content being crawled
public function tinyURL($url = null) { if ($url) { return file_get_contents("http://tinyurl.com/api-create.php?url=".$url); } else { return false; } }