Jul
24
By Julian  //  13 Comments

Maintaining PHP session when using CURL.

Working now on some iGoogle like dashboard for the system I’m developing.

I was trying some stuff out with CURL and was having a hard time to maintain my current session when making a curl request to another page. I needed to stay authenticated in order to retrieve my widget.

Here is my initial code:

$strCookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'] . '; path=/';
$ch = curl_init($rssFeedLink);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_COOKIE, $strCookie );
$response = curl_exec($ch);
curl_close($ch);

The problem with that piece of code is that it was generating a new session id instead of sending my current session.

The solution? Read more…

Jun
30
By Julian  //  No Comments

Firefox 3.5 Released

fflogo2A new version of Firefox has been released today. What was slated to be version 3.1 became a more major release that include many important improvements and features. The more important features that are worth nothing are privacy browsing and JavaScript speed improvements. The firefox team claims that version 3.5 javascript engine is twice as fast as version 3.0 and 10 times fater than version 2. Read more…

Jun
26
By Julian  //  No Comments

Need For Speed? Google’s Page Speed

Google recently release the competition to Yahoo’s YSlow. The Firefox add-on to test and analyze your website speed and performance. I have been using YSlow for quite some time. It has helped me optimized my websites dramatically. Well, now google has entered the market with a similar tool called Page Speed. Page speed consists of two parts, page speed activity and page speed.

The Page Speed tab is a summary of the performance. It gives a detailed report with it’s respective grade. With this report you can see the areas that are in need of optimization.  It covers the following topics: Read more…

Apr
24
By Julian  //  No Comments

Deal: 1yr Hosting plus Domain Registration for $9.24

DreamHost.com is offering 1 year of hosting plus domain registration for only $9.24. That is a 92% off their normal pricing. Just select “Host a Domain” and when asked for coupon enter “777″

If you only need a domain name, GoDaddy.com has a 1-Year Domain Name Registration for only $1.19. Use coupon “99BUYCOM”.

I’m not sure until when the offers are valid, so just go grab yours now before is too late.

Apr
22
By Julian  //  1 Comment

Zend Cache and Zend Feed Problem

Today I ran into a problem while caching feeds using Zend_Cache. I decided that I wanted to cache the returned object by the Zend_Feed. I had something like this:

$rssFeedLink = 'http://www.smooka.com/blog/';
$cacheId = 'rss_feed';

$frontendOptions = array(
		   	'lifetime' => 1800, // cache lifetime of 30 mins
		   	'automatic_serialization' => true);

$backendOptions = array(
		    	// Directory where to put the cache files
		    	'cache_dir' => '/cache/'
			);

// getting a Zend_Cache_Core object
$cache = Zend_Cache::factory('Core','File', $frontendOptions, $backendOptions);

if (!$rss = $cache->load($cacheId)) {
	try {
		$rss = Zend_Feed::import($rssFeedLink);
	} catch (Exception $e) {
		$feedError = true;
	}

	//check to see if it did not fail
	if (!$feedError && is_object($rss))
	{
		$cache->save($rss, $cacheId);
	}
}

//assuming that everything went right while fetching the feed
foreach ($rss as $item) {
	$channel['items'][] = array(
		'title'       => $item->title(),
		'link'        => $item->link(),
		'description' => $item->description()
	);
}

Read more…