Simple Twitter API XML Parsing in PHP

by admin on Feb.08, 2010, under Uncategorized

A friend asked me the best way to parse XML in PHP. I didn’t have an answer. It doesn’t sound like a weird request but usually the XML parsing is done on the client side(AJAX/Flash/XSL) instead of the server side…..the one usually serving the XML.

Some quick googling led me to believe that this was very monotonous before PHP 5.

Here’s a quick and dirty script to easily traverse some XML.

$xml = simplexml_load_file(“http://twitter.com/statuses/user_timeline.xml?screen_name=shitmydadsays”);

//root
echo $xml->getName() . “
“;

foreach($xml->children() as $status)
{
//status
echo $status->getName() . “: ” . $status . “
“;
foreach($status->children() as $items)
{
echo $items->getName() . “: ” . $items . “
“;
//user
if($items->getName() == “user”){
foreach($items->children() as $user){
echo $user->getName() . “: ” . $user . “
“;
}

}
}
echo ‘———————–
‘;
}

Take this and drop it in a file or download this zip(right click save as) and run it in localhost or on your server.

2 Comments more...

Missing flash.events package in Flex code hinting

by admin on Feb.06, 2010, under AIR, Flex

One of the many features you get spoiled with using in Flex Builder is code hinting. Unforunately, this is one of the things that break when you start installing new sdk’s….if you haven’t upgraded your Flex Builder in a while that is. Here’s the link to the upgrade from 3.0.1 to 3.0.2.

If your sdk isn’t finding the flash.events.* package, it will remove them when it goes to clean up your import statements. It also won’t help with code hinting at all, but it will still compile if you manual type in the import. Very annoying, but fixed.

1 Comment more...

SWFAddress with SWFObject gotcha’s

by admin on Oct.21, 2009, under Uncategorized

So a couple of things I’ve run into while using both SWFAddress and SWFObject. Thanks to some helpful blog posts, I found the answer to my issue was the order of my include statements.

Issue: Back/Forward isn’t dispatching SWFAddressEvent.CHANGE events. Some may be used to referring to that as the SWFAddress.onchange event. Either way, SWFAddress was working great, except for Back/Forward functionality.

Here’s what my simple embed code looked like before.

<script type=”text/javascript” src=”assets/script/SWFAddress.js”></script>

<script type=”text/javascript” src=”assets/script/swfobject.js”></script>

<script type=”text/javascript”>
window.onload = function() {
var so = new SWFObject(
“main.swf”, // source
“Main”, // id
“980″, // width
“100%”, // height
“10″, // required version
“#FFFFFF” // background color
);
so.addParam(“allowScriptAccess”, “always”);
so.addParam(“wmode”, “opaque”);
so.addParam(“FlashVars”, “language=en_US”);
so.write(“appContainer”);
}

</script>

And here’s the version with Back/Forward working!

<script type=”text/javascript” src=”assets/script/swfobject.js”></script>

<script type=”text/javascript” src=”assets/script/SWFAddress.js”></script>

<script type=”text/javascript”>
window.onload = function() {
var so = new SWFObject(
“main.swf”, // source
“Main”, // id
“980″, // width
“100%”, // height
“10″, // required version
“#FFFFFF” // background color
);
so.addParam(“allowScriptAccess”, “always”);
so.addParam(“wmode”, “opaque”);
so.addParam(“FlashVars”, “language=en_US”);
so.write(“appContainer”);
}

</script>

See a difference? The swfobject include statement is BEFORE the swfaddress include. Yes, it was really that easy. Thanks to NOBIEN for figuring out this simple fix. If you are looking in the error console trying to find a javascript error, it doesn’t happen. That non-error is the tricky part in this gotcha. It’s very difficult to debug a problem when you have no idea what the problem is.

This same problem will also arise if there is not an ID set for your content in SWFObject.

Leave a Comment more...

Award winning web development!

by admin on Sep.18, 2009, under Flex, Me, NVIDIA

I’m very happy to be part of the multi-award winning NVIDIA web team. :)

We won the Outstanding Website Award for our industry and we beat Intel, Dell and bunch of other really big sites!

http://www.webaward.org/winner.asp?eid=12434

The second one we got was really cool because it was for one of our many Flex applications, the Game Browser. Unforunately, I didn’t get to build this entirely from the ground up. A previous(great) developer, Brian Strong built that. I wish I did because it’s realllly cool but I did make some updates like adding the video player and some new filters.

http://www.webaward.org/winner.asp?eid=12435

Shout out to Shawn for all his help.

1 Comment more...

Blueprint – Another plugin for Flex 3/Flash Builder 4

by admin on Jun.15, 2009, under Uncategorized

It’s pretty cool functionality inside of eclipse. It keeps you from having to google your way through blog posts. :D

Install it the same way that you would any eclipse plugin.

Here is Adobe’s explanation of it.

With Blueprint, Flex and Flash developers can now query for sample code just as easily as they use auto-complete. Blueprint brings the power of the entire Web inside of the Flex Builder 3 Development environment and provides sample-centered search results that allow the user to quickly look through many different examples from many different websites including documentation, blogs, and forums.

The Blueprint preview is prerelease software that is not supported by Adobe and may contain bugs. We welcome your feedback, so please use the feedback link below to request features, make comments and report problems. Please also note that this is a research project and there is no assurance that there will be a shipping version of Blueprint.

enjoy!

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!