Solving Amazon S3 cURL Error when uploading an Object

Lately, I’ve been working on Amazon S3 API, wherein I’m uploading videos/object in the Amazon Server, however, I was really stuck on an error every time i’m uploading files into the Amazon. Here’s the error below:
Fatal error: Uncaught exception 'RequestCore_Exception' with message 'cURL resource: Resource id #16; cURL error: select/poll returned error (55)' in /home/user/ 824 Stack trace: #0 /home/user/ RequestCore->send_request() #1 /home/user/ AmazonS3->authenticate('bucket...', Array) #2 /home/user/ AmazonS3->create_object('bucket...', '1te0f0idn4.mp4', Array) #3 {main} thrown in /home/user/ on line 824

Now this is the start of a major headache which I thought I could pass this task quickly! After doing a quick research, I never found an answer, how sad :( , I even asked this at but unfortunately, I never got a correct answer. Anyway, nuf said!

Here’s what I did to combat this bug.

Simple 3 Steps.

  • Make sure to download the Latest Version of Amazon SDK for PHP 
  • After uploading the SDK into your site, point your browser to the location where you uploaded the SDK, then point it where the sdk_compatibility_test.php. Mine was You will see if you’re able to run the Amazon SDK in your site. I assume that you are able to run. Try to check the version of your cURL.
  • Since the error that we encountered was about cURL. Make sure that you have the latest version of  it. Mine is 7.21.0 (OpenSSL/0.9.8o). To update the version of your cURL, try to contact your hosting administrator.

There you go!! That’s how easy to solve that major bug that you’ve been stuck for so long.

So to make the debugging short, make sure you have the latest version of cURL because the lower version of cURL was quite buggy.

There was another solution that I read on how to solve the bug. It was like modifying the and changing the
‘certificate_authority’ => false
‘certificate_authority’ => true
but honestly that didn’t work for me, so I guess all of us have a different situation.

Okay! I hope this helps everyone! Have a Happy Coding!

Subscribing an RSS Feed using Google Reader API

For the past 3 days i’ve been looking for a good documentation on how to subscribe an RSS Feed using Google Reader API, unfortunately there was none. However, I found a PHP class that was created by dimmduh but still it lacks the functionality to Subscribe an RSS Feed. So to cut the long story short, I modified his code.

Here’s what I did, been using Ajax to fetch the value from google’s server but to be honest this should be done using JSON, I just didn’t changed it…

RSS: <input type='text' name='url' id="url" />
	<input type="button" id="click" value="Submit" /> <br/>
	<div id="result"></div>

		type: "POST",
		url: "grab_rss.php",
		data: "url="+jQuery("#url").val(),
		success: function(data){


	$username = "googleUsername"; #do not include the ''
	$password = "googlePassword";
	$url = $_POST['url'];

	$r = new GoogleReaderAPI( $username, $password );
	echo $r->subscribe_rss( $url );

public function subscribe_rss( $rss_url )
  $ck = time();
  $client = $this->client;

  $post_fields = array (
		'quickadd' => $rss_url,
		'T' => $this->token

  $this->request2google( 'subscription/quickadd?ck=$ck&client=$client', "post", false, $post_fields );

You will get a JSON format result.

So that’s how easy to subscribe an RSS Feed using Google Reader API.

Have a Happy Coding!

Export Database data into A CSV or Excel in PHP

This is the easiest way to export from a database data into a CSV or Excel.

$filename = "excelreport.xls";

$contents = "Order Number \t Billing First Name \t Billing Middle Name \t 
              Billing Last Name \t Billing Address1 \t Billing Address2 \t Billing City \t 
              Billing Zip \t Billing State \t Billing Phone \t Shipping First Name \t 
              Shipping Middle Name \t Shipping Last Name \t Shipping Address1 \t 
              Shipping Address2 \t Shipping City \t Shipping State \t Shipping Zip \t 
              Shipping Phone \t No. of Adults \t No. of Children \t 
              No. of Young Children \t Amount Paid \t Trip Date \t Order Date \t 
              Invoice Id \t Email Address \t Tour Name \t \n"; 

$result = mysql_query( "SELECT * FROM `placed_orders` ORDER BY order_date" ) or die( mysql_error() ); 

while( $row = mysql_fetch_array( $result ) ) 
    $contents .= $row['id']." \t ".$row['billing_first_name']." \t ".$row['billing_middle_name'];

    $contents .= " \t ".$row['billing_last_name']." \t ".$row['billing_address1']." \t".$row['billing_address2']. " \t "; 
    $contents .= $row['billing_city']." \t ".$row['billing_zip']." \t  ".$row['billing_state']." \t "; 

    $contents .= $row['billing_phone']." \t ".$row['shipping_first_name']." \t ".$row['shipping_middle_name']." \t "; 
    $contents .= $row['shipping_last_name']." \t ".$row['shipping_address1']." \t    ".$row['shipping_address2']." \t "; 

    $contents .= $row['shipping_city']." \t ".$row['shipping_state']." \t ".$row['shipping_zip']." \t "; 
    $contents .= $row['shipping_phone']." \t ".$row['adults']." \t ".$row['children']." \t "; 
    $contents .= $row['young_children']." \t ".$row['amount_paid']." \t ".$row['trip_date']." \t "; 
    $contents .= $row['order_date']." \t  ".$row['invoice_id']." \t ".$row['email_address']." \t "; 
    $contents .= $row['tour_name']." \t \n "; 

header('Content-type: application/ms-excel'); 
header('Content-Disposition: attachment; filename='.$filename); 

echo $contents; 

Just replace the mysql credentials with your credentials. You can also put your own mysql query.

Have fun coding!