How do I get started implementing the grooveshark api - php

I have a client who wants me to implement the Grooveshark API into his site to be used as a fully fledged music system. It will be able to play, pause and skip songs from playlists that the user creates and and tracks the user favourites. So the user will have the ability to search for a track, add to playlist, favourite, play and the reverse of all these actions.
My question is. How do I get started. So I have the API (well the public version http://www.apishark.com as I am waiting for the full version to be sent to me). I look at the API and I just see what appears to me to be short snippets of code.
Is there some kind of a default way to implement an API, what do I need to know, how do I go about this task?
Any help will be appreciated.

Here you can find a php class to ease your work. It's not free but it's extremely cheap, and if you are not able to sort our how to use a standard REST api, and you have to do this for a work, maybe it's worth the price.
Or you can try here for a free class, but I never tried it and you have to use git to download the last version. I believe it's still under development, though.
Or, here you find a free python script that maybe it's easy to convert in PHP. Same here for a perl module.

Related

Get Twitter feed based on multiple hashtags

I am trying to build a web application that would display Twitter feed based on multiple hashtags in real time. Something like TweeterWall. I've been Googling around, but there are so many APIs that I am a bit confused.
My setup is a standard shared hosting with PHP and MySQL.
My question: Which method is best suited for my environment?
Should I use Streaming API, Search API, Sockets, maybe Javascript with setInterval()..
i realy ont know..
Thanks for your answers.
- Cheers
Take a look at this project on GitHub. Don't be confused by the title - it has been updated since Twitter's API update to 1.1.
The jQuery plugin on the page has been re-purposed to be a Rendering engine, i.e. it helps with rendering your feeds.
The important part, however is in the "Server-Side Examples and Setup" directory. Go there, read the SETUP_INSTRUCTIONS document, and use the code in the "Plug_and_Play/Ready_PHP.php" file as your starting point.
If you followed the instructions in the SETUP_INSTRUCTIONS document, you should only have to copy and paste the keys from Twitter into the file, along with a Twitter handle, and it should render the timeline for you.
Note that you will have to update the code to render multiple timelines, and will have to either use AJAX or some other solution for updating the timelines, to simulate real-time.
On that note, be careful not to blow the rate-cap. If you are rendering timelines for just two Twitter handles, you can update them only once every 6 seconds (best case scenario). To do this, you will have to use a separate web service to perform the requests and then query that service from your webpage.
P.S. I am the author of that project, so if you need any help, let me know. Good luck! :)

Technique behing creating a google wave like asynchronous web app

I want to try creating a canvas were multiple users can type and edit for brainstorming etc. I am thinking of php as backend. What are the technique used for it? For example, lets say its
pure text. How do we update the text like in the google wave(b4) and in google doc?
Is it just using websocket(or js pooling) and updating the text file? or are there any
better logical way to solve this issue?
Well, its not as easy as it is said in Brad's answer but he is partially right. You will definitely need WebSockets today to make it happen. But logically, it is not that simple to create a collaborative environment. There are issues like broadcasting changes of every user to every other user viewing the same document. Then you will have to make sure that every user gets to see exactly the same thing no matter who changes what and when. This gets difficult when multiple users are working on the same document collaboratively. There can be conflicts while merging changes of one another.
As far as PHP is concerned, language is not really a problem. Its how you handle the above stated problem.
Google released its research and engineering details on Google Wave (I guess after abandoning the project). This link might be some help to you: http://www.waveprotocol.org/whitepapers/
Websockets are the way to go for this. However, they are difficult to implement in PHP, and not supported by many browsers as of yet. You can do long-polling of AJAX requests pretty easily with PHP, but it can be quite a waste of resources.
This might not be what you are looking for, but I'd suggest changing your server-side technology. You can use Node.js with Socket.IO to easily use Websockets (or seemlessly emulate them for browsers that don't support them). This will provide the fastest method for pushing data to your users.

Existing PHP Tool for Feature Toggle

Recently I've read a number of articles talking about the idea of using "feature toggles" or "gatekeepers" to keep features hidden from users until the development is done. Facebook and Flickr both also talk about how they use this to test new features with a subset of users before unleashing them on everyone.
A bit of googling didn't turn up any existing PHP packages/tools that can be added to a web app to handle this type of thing. It seems straight forward enough to roll our own but no reason to re-invent that wheel if we don't need to. Are there any existing PHP tools to do this?
Articles
Feature Toggle by Martin Fowler
Flipping Out on Flickr DevBlog
Clarification: The part of this that I'm looking to see if it exists is the admin panel that controls which users can see the new features. In Flickr's example, they can turn it on based on the host. In the Facebook example, they add functionality such as limiting a feature to 5% of users, only TechCrunch users or only East coast users.
The admin panel seems crucial when you have 200 turned on features, 10 features that aren't quite done yet and 3 more that you're demoing for some users.
if (user_can_see_app()) {
show_app();
} else {
dont_show_app();
}
I fail to see why a package would be required for something so simple.
I've wrote a micro service for feature toggle pattern, called Bipolar:
https://marinho.github.io/bipolar-server
It is written in Python but that doesn't matter because it is an external API and Admin interface, so, all you need is to write a PHP client for it. We have used it in production for a while but only worked on public release and documentation recently. For JavaScript support it can push notifications using Webhooks as a basic URL call or via Pusher event.
I am bit missed after many years with no contact with PHP, but I can help you to write the client if you are interested.
I hope that can be helpful.
The easiest solution i found is to have the feature toggle state stored in some remote location that can change easily (turn it on/off)
I found it easy to have on GitHub a repo holding some JSON data with the feature toggle's state, later on you can change that state on GitHub (from phone/pc etc...)
your php code needs to fetch the JSON and make a decision from it ...
you can look at the blog post about how to achieve this:
http://www.nimrodstech.com/dead-simple-feature-toggle/
it shows a code snippet of how to achieve this in a simple way.

Browser screencasting

Hey, I'm trying to make a web app that allows users to write on a virtual drawing pad and record their drawings as the progress as a video. I know there's screen casting software out there, in fact, I have such software on my computer but I'm trying to create this ability online. Would anyone be able to suggest where I should start looking so that I could figure out how to do this?
I have pretty good programming skills with in flash and I'm good with php.
Thanks,
Mike
You might look into internet whiteboard software, like this one. A company called GroupBoard offers this as a service, including free offerings. Their stuff isn't great, but they're one of the only companies who offer it without requiring use of a browser plugin.
The link I provided contains tutorials for creating a whiteboard using AJAX alone.
You might want to try this product which allows you to record a collaborative whiteboard session, and optionally have it automatically uploaded to Vimeo. It can be embedded on your website.

Quickest way to implement a searchable, browsable image gallery - flickr integration?

I have a friend who is need of a web page. He does interior construction, and would like to have a gallery of his work. I'll probably go for a php host, and was thinking about the best way to implement the image gallery for him. I came up with:
Use flickr to host the images. They can be tagged, added to sets, and I can use both the tag and set information to display "categories" for the gallery, as well as browsing. Flickr also has multi-upload tools so that a 20 photo job won't be a PITA to upload.
How to best get at the api? Is there a good PHP library for flickr integration? Should I roll my own?
API key - is this considered a commercial project? The web page is for his business, and he will be paying me to create the site...
Is flickr the wrong tool for the job? It seems like a pretty good solution in my head, but is there something I'm missing? I haven't used their APIs at all.
Thanks for any input!
It sounds like a difficult way to do things - have you considered Gallery (No points on creativity for the name!).
Unless you're really wanting to save on bandwidth, I think you'd get much better results from installing some pre-built gallery.
The perfect solution for this kind of thing is Picasa (from Google ofcourse)
You get:
1gb of free storage space on a Google Picasaweb account that already has a web interface with embeddable slideshows and stuff
A compete image browse and upoad program for the client side (namely Picasa) that's directly connected to the web albums. It's so user friendly that even your grandma can put her pictures online with that.
RSS feeds and an API from google.
there's a custom light-weight PHP api available
Need anyting else?
Note from Chris to others that may be looking for an answer: The API can be found here.
I recently implemented a Flickr-based photo gallery for a client. Flickr was perfect for them for a lot of reasons. Gallery is an impressive open-source project, but its feature set (and complexity of administration) was overkill for what this client needed.
Check out the Flickr API, especially the section on building URLs, which will be necessary when building your web pages. Don't bother coding a PHP wrapper for the API's. phpFlickr has already done it, and it's a smart implementation.
Here's a helper function I wrote that made life a lot easier for the various pages that need to access Flicker:
function newFlickr()
{
static $flickr = NULL;
if($flickr != NULL)
{
return $flickr;
}
$flickr = new phpFlickr(api-key, secret);
$flickr->setToken(token);
$flickr->enableCache("db", "mysql://acct:pass#localhost/flickrcache");
return $flickr;
}
The trick here is that all the crud you need to enter is stored in a central place in your code. Caching is key, so use it. And, if you need a phpFlickr object in multiple places for each request, you're only ctor'ing it once, which saves on init time.
Having Read SchizoDuckie's post, I had a look at the picasa api for php, and found it a bit daunting to start with, however I found this sample code absolutely brilliant for getting started with some basic integration.
Samples for other languages also seem to be available - can't vouch for their usefullness, but suspect they will be good too.
These might be of help. They are mootools scripts and run without any server-side coding necessary. Both integrate with Flickr.
http://imago.codeboje.de/
http://www.moopix.org/
If you have any interest in Ruby on Rails, there is a screencast here that shows how to create a site similar to what you are describing in RoR.

Categories