Brendon Smith AKA SeaCloud9 Design - tagged with php http://life.brendonsmith.com/feed en-us http://blogs.law.harvard.edu/tech/rss Sweetcron brendonsmith@seacloud9.org iPad Detection Using JavaScript or PHP http://life.brendonsmith.com/items/view/1654/ipad-detection-using-javascript-or-php ]]> Fri, 07 May 2010 11:41:23 -0700 http://life.brendonsmith.com/items/view/1654/ipad-detection-using-javascript-or-php Okada Design Blog » Blog Archive » Zend Framework on Codeigniter: Youtube http://life.brendonsmith.com/items/view/1242/okada-design-blog-blog-archive-zend-framework-on-codeigniter-youtube ]]> Sun, 22 Nov 2009 19:55:04 -0800 http://life.brendonsmith.com/items/view/1242/okada-design-blog-blog-archive-zend-framework-on-codeigniter-youtube jsc (c# to javascript) http://life.brendonsmith.com/items/view/1073/jsc-c-to-javascript

c# to javascript, php, actionscript, open source

]]>
Tue, 20 Oct 2009 10:30:30 -0700 http://life.brendonsmith.com/items/view/1073/jsc-c-to-javascript
Flex for PHP developers : Mihai CORLAN http://life.brendonsmith.com/items/view/934/flex-for-php-developers-mihai-corlan ]]> Wed, 19 Aug 2009 07:21:09 -0700 http://life.brendonsmith.com/items/view/934/flex-for-php-developers-mihai-corlan ZendAMF and the Twitter API http://life.brendonsmith.com/items/view/854/zendamf-and-the-twitter-api

Have you ever had the urge to roll your own twitter? Well I have and I have tried a number of methods to come to the conclusion I needed to write everything from scratch. So I did and I wouldn’t say that I wasn’t without help. I did study Lee Brimelow’s gotoandlearn.com ZendAMF tutorial. So I went about downloading and install zend on my server and I found it was extremely easy to use. One of the many things that attracted me to the Zend framework were the prebuilt services. The zendframe work is a mature framework that has a great deal to offer developers so I will briefly show you a simple amf flash gateway built with zend to fetch the twitter service. Also please note you will have to create your own classes if you want to extend this but it should be pretty easy to do considering..

So first off download the zendframework. Configure your zendAMF endpoint. Create your own ZendAMF endpoint:

?View Code PHP<?php error_reporting(E_ALL|E_STRICT); ini_set("display_errors", "on");   ini_set("include_path", ini_get("include_path") . ":/home/toYourZend/FrameWorkHome/frameworks/zendFramework/library/"); require_once('Zend/Amf/Server.php'); require_once('TwitService.php');   $server = new Zend_Amf_Server(); //adding our class to Zend AMF Server $server->setClass("TwitService"); echo ( $server -> handle() ); ?>

Now configure your zend Twitter Service Create Your Twitter Service Class:

?View Code PHP<?php error_reporting(E_ALL|E_STRICT); ini_set("display_errors", "on");   ini_set("include_path", ini_get("include_path") . ":/home/toYourZend/FrameWorkHome/frameworks/zendFramework/library/"); require_once ('Zend/Service/Twitter.php'); require_once('VOgetFriendsTimeline.php'); //connection info   class TwitService { public $tmp; public $twitter; public $response;   public function __construct() { }   public function getfriendsTimeline() { $twitter = new Zend_Service_Twitter('YourUserName', 'YourPassword'); $response = $twitter->status->friendsTimeline(); $tmp = new VOgetFriendsTimeline(); for ($i = 0; $i <= 18; $i++){ // array_push($tmp->userTwit, $response->status[$i]); array_push($tmp->userTwit, (string)$response->status[$i]->user->screen_name); array_push($tmp->statusPic, (string)$response->status[$i]->user->profile_image_url); array_push($tmp->locTwit, (string)$response->status[$i]->user->location); array_push($tmp->friendsTimeline, (string)$response->status[$i]->text); } return $tmp; }   public function UserPostUpdate($tweet){ $twitter = new Zend_Service_Twitter('YourUserName', 'YourPassword'); $response = $twitter->status->update($tweet);
}     }

Now configure your flash variable object that is exposed by the service.

?View Code PHP<?php class VOgetFriendsTimeline { public $user_twit; public $pass_twit; public $locTwit = array(); public $friendsTimeline = array(); public $statusPic = array(); public $userTwit = array(); public $text; public function __construct() { } }

Finally configure your flex project to consume the service. Flash Twitter and Google Map Integration

?View Code ACTIONSCRIPT<?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="600" height="300" xmlns:maps="com.google.maps." initialize="init()"> <mx:VBox width="100%" height="100%"> <mx:HBox width="100%" height="0" visible="false"> <mx:TextInput id="address" text="Sydney AU" dropShadowColor="0x000000" visible="false" /> </mx:HBox> <maps:Map id="map" key="yourAPI Key" mapevent_mapready="onMapReady(event)" width="100%" height="100%"/> </mx:VBox> <mx:Script> <![CDATA[ import com.SampleTitleWindow; import flash.events.Event; import mx.events.MenuEvent; import mx.collections.; import mx.managers.PopUpManager; import mx.controls.Alert; import nl.demonsters.debugger.MonsterDebugger; import flash.net.*; import com.google.maps.services.ClientGeocoderOptions; import com.google.maps.LatLng; import com.google.maps.Map; import com.google.maps.MapEvent; import com.google.maps.MapMouseEvent; import com.google.maps.MapType; import com.google.maps.services.ClientGeocoder; import com.google.maps.services.GeocodingEvent; import com.google.maps.overlays.Marker; import com.google.maps.overlays.MarkerOptions; import com.google.maps.InfoWindowOptions; import mx.controls.Alert; import com.google.maps.controls.ZoomControl; public var nc:NetConnection = new NetConnection(); public var resp:Responder = new Responder(onResult, onError); public var resp1:Responder = new Responder(onError); public var obj:Object = { }; public var tweetLocN:int = new int(); public var geoLocationTwit:Array = new Array(); public function init() { nc.objectEncoding = ObjectEncoding.AMF3; nc.connect("http://yoursite.com/toYour/zendEndpointAMF/index.php"); nc.call("TwitService.getfriendsTimeline",resp); }   public function onResult(e:Object) { var arr:Array = []; for (var i:int = 0; i < e.friendsTimeline.length; i++ ) {   if (e.locTwit[i] != "" ) { trace(e.locTwit[i]+"----------------Pushed!!!!!!!!!!!!!!!!!!!!"); try { address.text = e.locTwit[i]; doGeocodeTwit(e.locTwit[i], e.userTwit[i],e.friendsTimeline[i] ); } catch (epicFail:Error) { } trace("EpicFail Caught"); } trace(e.locTwit[i]+"Result Fired++++++++++"); tweetLocN = geoLocationTwit.length; arr.push(obj); } trace(obj.loc+"Result END++++++++++"); //datagrid.dataProvider = arr; } public function onError(e:Object) { trace("And the Error is !!!!"); trace(e); }
private function onMapReady(event:Event):void { map.enableScrollWheelZoom(); map.enableContinuousZoom(); map.addControl(new ZoomControl()); }       private function doGeocodeTwit(event:String, userTwitter:String, userTweets:String):void { // Geocoding example trace(event+"String is+++++++++++++++++"); var geocoder1:ClientGeocoder = new ClientGeocoder();   geocoder1.addEventListener( GeocodingEvent.GEOCODING_SUCCESS, function(event:GeocodingEvent):void { var placemarks:Array = event.response.placemarks; trace(placemarks+"+++++++===== Ran PlaceMark"); if (placemarks.length > 0) { map.setCenter(placemarks[0].point); var marker:Marker = new Marker(placemarks[0].point); marker.addEventListener(MapMouseEvent.CLICK, function (event:MapMouseEvent):void { var mainTweet:String = new String(userTwitter + " - User - Tweet:" + userTweets); marker.openInfoWindow(new InfoWindowOptions({content: mainTweet})); }); map.addOverlay(marker); } }); geocoder1.addEventListener( GeocodingEvent.GEOCODING_FAILURE, function(event:GeocodingEvent):void { //Alert.show("Geocoding failed"); trace(event); trace(event.status); }); geocoder1.geocode(address.text); }       ]]> </mx:Script>   </mx:Canvas>

Code Thats it! View the live example here! Other Cool Twitter Mashup links can be found:

Twitter MashUp Links

Don’t forget to check out Lee Brimelow’s GotoandLearn AMF video. Zend framework Zend Services Bookmark and Share More »Powered by Bookmarkify™

]]>
Mon, 03 Aug 2009 15:08:44 -0700 http://life.brendonsmith.com/items/view/854/zendamf-and-the-twitter-api
WebR3 http://life.brendonsmith.com/items/view/835/webr3 ]]> Sun, 02 Aug 2009 11:31:44 -0700 http://life.brendonsmith.com/items/view/835/webr3 Zend_Amf with full Zend Framework at Space of Flex/AIR technologies http://life.brendonsmith.com/items/view/799/zend-amf-with-full-zend-framework-at-space-of-flexair-technologies

<mx:RemoteObject id="zendRemoteObject" destination="zend" source="MyAmfService" endpoint="http://localhost/messagebroker/amf" result="Alert.show(event.result.myProperty)"/>

]]>
Sun, 26 Jul 2009 07:46:47 -0700 http://life.brendonsmith.com/items/view/799/zend-amf-with-full-zend-framework-at-space-of-flexair-technologies
It is what it is » Blog Archive » JSON support for WordPress http://life.brendonsmith.com/items/view/797/it-is-what-it-is-blog-archive-json-support-for-wordpress ]]> Wed, 22 Jul 2009 18:02:15 -0700 http://life.brendonsmith.com/items/view/797/it-is-what-it-is-blog-archive-json-support-for-wordpress bbPress » About http://life.brendonsmith.com/items/view/730/bbpress-about ]]> Sat, 18 Jul 2009 22:38:13 -0700 http://life.brendonsmith.com/items/view/730/bbpress-about <a href="http://www.up2udesign.nl/weblog/wp-content/uploads/2008/12/flexphp.txt">http://www.up2udesign.nl/weblog/wp-content/uploads/2008/12/flexphp.txt</a> http://life.brendonsmith.com/items/view/630/httpwwwup2udesignnlweblogwp-contentuploads200812flexphptxt

Communicate to AS3 Compiler w/ PHP

]]>
Tue, 07 Jul 2009 19:36:45 -0700 http://life.brendonsmith.com/items/view/630/httpwwwup2udesignnlweblogwp-contentuploads200812flexphptxt
Browser.php - Detecting a user’s browser from PHP | Chris Schuld's Blog http://life.brendonsmith.com/items/view/422/browserphp-detecting-a-users-browser-from-php-chris-schulds-blog

PHP5 browser detection class

]]>
Thu, 28 May 2009 18:49:30 -0700 http://life.brendonsmith.com/items/view/422/browserphp-detecting-a-users-browser-from-php-chris-schulds-blog