I'm attempting to put together a little mashup with some twitter APIs. However, the whole area is new to me (I'm more of an embedded developer dabbling). And frustratingly, every tutorial I am trying in Php is either out of date, not doing what it claims to do, it or is broken.
Essentially, I just want a nice bit of example code - say, an HTML file, a connection.js for the JQuery magic, and a php file - 'getsearch' which contains the relevant Curl calls to the API to just return the results for a given search term.
Followed the tutorial to the letter at
http://www.reynoldsftw.com/2009/02/using-jquery-php-ajax-with-the-twitter-api/
and even downloaded the guy's code and chucked it on my webserver, but it just seems to sit there.
I'm relatively competent at php and html, but it's the Curl and the JQuery side of things which is new to me, and would appreciate any thoughts, links, or code suggestions. I've attempted reading the API - but even that seems sparse - and several links are broken to their own tutorials, so that's put me off a bit for now.
Finally found a working one.
http://papermashup.com/using-the-twitter-api/
This tutorial (or just the php file at http://greenservr.com/projects/twittersearch/TwitterSearch.phps) has the basics including php, jquery and curl to get something back from the twitter API). Finally have something going, so now can expand and extend :)
check the link http://webhkp.wordpress.com/2010/04/13/twitter-api-search-follow-tweet/. this is a great post i found and really helpful for me. hope you fined something helpful here.
Related
I am very entry level php. I am fairly proficient in wordpress and I have created some simple plugins. My situation is, I would like to recreate google's way of displaying a wikipedia article. I would like to be able to use a shortcode with the person's name and have it return the same results google would return and styled the same way just on my wordpress website. I know Wikipedia has an api that allows for search and display, I am just trying to wrap my head around the process. If someone could point me in the right direction of how this would be achieved in php or wordpress I would really appreciate it. I know there are some similar questions on here about the wiki api but I would like to hear some different approaches to finding the best way to achieve what google is doing.
If you don't know what I am talking about, try googling someone famous who would have a wiki article and it will display on the right hand side of the screen with their photo and their info in a very nicely displayed box. Can this overall page info be queried all at once, or does each piece of information have to be queried from wiki and then displayed that way with css?
Forgive me if this is to vague or has already been covered. I am very interested in peoples logic to approaching this situation. Any information on this would be very helpful.
You'll be lucky if this doesn't get downvoted to hell, but I'll try and give you at least a basic run-through.
There are two ways to approach this. AJAX or PHP. The PHP method is a little more complicated to wrap your head around (at least for me anyway).
PHP
First, you should sit down and REALLY read the Wikipedia API manual and sources. The people behind Wikipedia have put a ton of effort into it and wouldn't have done so without giving you information on how to use their system. Don't be intimidated--it's really not that hard.
Second, after you've read the API, you'll know what this url means.
http://en.wikipedia.org/w/api.php?format=json&action=query&titles=Main%20Page&prop=revisions&rvprop=content
A method that might work without using CURL, which can be very confusing, is file_get_contents().
So set the query string parameters for the api, and use them like so:
$api_call = file_get_contents('http://en.wikipedia.org/w/api.php?format=json&action=query&titles=Main%20Page&prop=revisions&rvprop=content');
$api_data = json_decode( $homepage );
Now you should have an array that you should easily be able to manipulate and place into your site.
jQuery/AJAX
Way easier in my opinion, and you have the added bonus of some user manipulation:
$.ajax({
type: 'GET',
url: 'http://en.wikipedia.org/w/api.php?format=json&action=query&titles=Main%20Page&prop=revisions&rvprop=content'
}).done(function(data){
var d = $.parseJSON( data );
$('div.data-holder').html( 'foo'+d.bar );
});
None of this is tested. Just meant for a general idea. Hope this helps.
So, i would like to download youtube videos using a php script. I have googled a lot for now and there where more solutions but the one was using the http://youtube.com/get_video?data url but that is not possible now for a long time. I have found a greasemonkey script which works fine but i don't have a clue how could it work with php.
I have read that i must do something with the info which gives me for example this link:
http://www.youtube.com/get_video_info?video_id=g1SADcP5g1o
The question is what would be the best approach for this?
I would try to get some curl requests going on any of these resources and try to automate it that way.
I have it written in C++, not PHP. But it's not very simple yet not very complicated either. get_video_info output is URL encoded. Decode it and look for the stream_map set of streams. You'll notice a pattern in it. That's your starting point. Contains resolutions and download locations plus extras.
I wouldn't paste the PHP code here even if I had it :) They tend to change it...
I'm looking for a way to create a QR Code and a shortened link when a form is submitted. I have the QR Code bit, but the link is too long for me and the QR Code looks scary and complicated. The way it works is; the user types in (in this instance) a contract number. Then, a folder is created on the server of that contract number. (www.mysite.com/QR/$contractnumber). Then, using PHP again, I create a QR Code through Google because I know that every QR code will be linking to the same place, just a different ending of the link. The only bit that changes is the $POST...
I was wondering if there was a way to shorten the link before it goes to Google? It would have to be through php. The user enters the contact number in the form, then that number(usually around 5/6 digits) will be entered into a already existing command? I'm not an expert in anything, I just know some really random snippets of code... And HTML and CSS, of course.
Any help would be appreciated and judging by the few days I have been searching this, I think it might help a few people in the future. I would also like to confirm that the solution can't be one of this visual URLShorteners. If it is, it just needs to be the back-end of it, built into a existing form and QR Generator. Simple?
We had a similar challenge with one of our internal apps, and since any shortcut system (that I know of) relies on a database to translate what the short url really means , we opted to start our work from something that had already been done, rather than re-invent the wheel and based our solution on yourls.org.
We installed that, and populated the database from within our PHP, not really using the provided interface for anything except testing and it's statistics. It's reasonably flexible, and while it does need some standards improvement, the core code that we were interested in (as you would be) was sound, and worked very well for us.
It sounds like you might be able to use the TagLabs solution. Check out the developer site; developer.taglabsinc.com and create a free account at portal.taglabsinc.com. The platform will create the QR Code and shortened url. You can manually create the QR Codes or leverage the API.
For what it's worth, that's exactly what a.zat.is for. Disclaimer: I made it.
I'm trying to traverse the whole PhoneGap thing to get a native app up and running. I am completely fine with creating html5 markup for the actual app, what I need help with is trying to pull in dynamic content from a website. In particular, there is some content on our website that also needs to be in the app. We use a program call Expression Engine that handles all of our content. The content that I would need to pull over would be:
Sermon Videos
Sermon Series
Locations
Plain text content
The majority of the app will be local, but there are some dynamic needs as you can see. I've read a couple things that say "JSON" is the way to go, but it looks pretty complicated as I'm not quite familiar with AJAX. Is this the only way or are there any options or resources anyone can point me to that might help. I'm not even sure if that method would work for our website. I appreciate any help you can provide.
They are correct. What you need to look into is AJAX/JSON and how to present your data to your app using these technologies.
Expression Engine would actually be quite a good choice for this as its template system is quite flexible. There are even add-on modules for delivering your content as JSON if you want t go that route.
A quick google led me to: http://samcroft.co.uk/2011/updated-loading-data-in-phonegap-using-jquery-1-5/
It's a bit more than you need since you will have your content in an existing CMS instead of creating a new database to store the data, but the concepts will hold true and I am sure you will be able to use it to find more tutorials that suit you better.
Anyone know a good tutorial of how to make the status bar found in the new facebook? the one on the bottom. looks really cool
i was thinking it was written in either ajax or jquery. but not sure.
Here are some useful links/plugins that might help you:
Positioning the footer
Enable drag/drop of things (like applications)
Tooltip (when hover)
And for the interaction with the server (for new events etc.) you might use the AJAX functionality in jQuery:
In order to have it always be in the bottom, that is more of CSS than javascript.
I think you would get better answers if you were more specific. For example, I would want the answer to revolve around as to how the chatroom works on facebook. Is the javascript request being sent every second to check for new messages? or is there another protocol being used in order to have instant messages?
It's not clear what your are looking for: bar's design or it's functionality. If your are speaking about design you should look into css positioning (absolute). If it's about functionality i suppose that there is some kind of ajax javascript which checks every x seconds if there is change of state, and if there is go deeper and find out what to load.
Why not just download the Facebook source code and take a look at how they do it? They open sourced a lot of the stuff they use/created/enhanced.
Soh Tanaka just put out a great step-by-step tutorial on how to re-create the Facebook Status Bar:
Here's another good starting point: http://www.ben-griffiths.com/project/jquery-position-footer/. If I remember correctly it works in FF & IE & Safari
I looked through the jQuery plugins, and Googled the topic for you. All I could find was this which isn't exactly what you want, but it is a good place to start. With some style changes, and a little tweaking it could easily look exactly like the Facebook bar.
Not sure that this is the type of answer you were looking for, but i've been looking for the same thing and this code seems to at least show how it's done.