public function pushTweets($tweetArray) { foreach ($tweetArray as $tweet) { $profile_image_url = $tweet->profile_image_url; $tweetID = $tweet->id; $created_at = $tweet->created_at; $created_at = from_apachedate($created_at); $geo = $tweet->geo; $iso_language = $tweet->iso_language; $source = $tweet->source; $result_type = $tweet->result_type; $to_user = $tweet->to_user; $to_user_id = $tweet->to_user_id; $from_user = $tweet->from_user; $from_user_id = $tweet->from_user_id; $tweet_txt = htmlspecialchars($tweet->text, ENT_QUOTES); $qry = "INSERT INTO tweets (profile_image_url, tweetID, created_at, geo, iso_language_code, source, result_type, to_user, to_user_id, from_user, from_user_id, tweet_txt) VALUES ('" . $profile_image_url . "', '" . $tweetID . "', '" . $created_at . "', '" . $geo . "', '" . $iso_language . "', '" . $source . "', '" . $result_type . "', '" . $to_user . "', '" . $to_user_id . "', '" . $from_user . "', '" . $from_user_id . "', '" . $tweet_txt . "');"; if (!DEBUG) { mysql_query($qry); } } }
<?php date_default_timezone_set('UTC'); $str = strtotime("Mon, 10 May 2010 21:57:08 +0000"); $str2 = time(); echo from_apachedate("Mon, 10 May 2010 21:57:08 +0000"); function from_apachedate($date) { list($D, $d, $M, $y, $h, $m, $s, $z) = sscanf($date, "%3s, %2d %3s\n\t%4d %2d:%2d:%2d %5s"); return strtotime("{$d} {$M} {$y} {$h}:{$m}:{$s} {$z}"); }