Pubsubhubbub handle in php - php

I need to watch a certain feed for my web app and i can't find any proper documentation about this topic
-Edited:
what i'm actually after is probably so simple that it might be embarrassing :)
i know the hub will use a POST request to deliver the updates but i don't know how to fetch that data using $_POST because i don't know the key value in the $_POST array
I'd love to see basic PHP code example on how this is done
thanks

I don't know how good it is, but there is an implementation being developped in Zend Framework ; it's currently still in incubator, but maybe it might interest you : /standard/incubator/library/Zend/Feed/Pubsubhubbub

OK
problem solved, i found the protocol wrappers section at php.net.
"php://input" is what i was looking for
http://www.php.net/manual/en/wrappers.php

Related

Using Google Adwords API in PHP

Hi there I was wondering if anyone could help me out.
Basically I am trying to use the trafficEstimatorService in order to retrieve how much traffic a keyword that is entered through a HTML generates.
I have an idea of how to make it work but I am totally new to using the google API.
Firstly would I create the form in php and perform a GET request on the trafficEstimator url with the keywords in the form as parameters?
Thanks!
I found that the hardest part of getting started was the Oauth Authentication. Ewan Hemming's tutorial on the subject helped me out a lot: http://www.ewanheming.com/adwords-api-oauth-tutorial
Take a look at https://github.com/googleads/googleads-php-lib
It's a php client library including examples on how to do things + a video which is a very good and detailed starting point.
If you already tried to follow Make Your First API Call and video with talk through instead of walkthrough of the steps and you felt confused and unclear, then here is step by step tutorial for you.

How do I perform REST queries in (cake)php?

I'm trying to pull some data into my CakePHP site using a REST API. I'm familiar with CakePHP, but not with REST, so I'd like some guidance as to the best way to do this. I've looked online, but a lot of what I find is either telling me how to make my own API, or it's quite old, and I'm not sure if it's still relevant.
The API documentation tells me to make the query request
http://api.sitename.com/rest/organizations/my_id/media.xml
where my_id is a string that I have.
I'm using:
$url = http://api.sitename.com/rest/organizations/my_id/media.xml;
$result = file_get_contents($url);
and then I have the XML in $result.
Is this the best way to do this?
Short, direct answer to:
Is this the best way to do this?
No
Head over to the PHP cURL documenation for more info on how to "talk" to public web services.
After looking into cURL as Charles Sprayberry suggests, you'll then want to learn about parsing XML in PHP to be able to do something with the data that you retrieve.
I found this article to be useful for understanding a bit about Cake and ReST:
http://nuts-and-bolts-of-cakephp.com/2010/06/27/putting-semi-restful-api-development-to-rest/

Create a REST service

I want to create a REST service with PHP 5. I'd appreciate it if people would recommend some guides/tutorials on the subject. I'd like tutorials that cover the whole process, including the creation, securing and deployment of the service. Thanks.
I've been planning on building a full API/REST interface as of yet I've only implemented some features. The key concept that you need to get around is that it is simply a XML/JSON (etc) response to a predefined url.
You can quite easily get set up using .htaccess & mod rewrite to allow domain.com/method/var/id or some similar structure to redirect to domain.com/script.php?method=method&?var=var&?id=id . Once this is done, you can use these in your script, create your response and return it(print/echo) to script.php .
When a user sends a request, they will received the result that you have specified.
Json is very easy to use and implement thanks to http://php.net/manual/en/function.json-encode.php
You want to look into mod rewrite for apache.
As for authentication, it shouldnt differ to any other login/authentication have a look at sessions for php. http://php.net/manual/en/features.sessions.php
Hope this helps.
You could check out the wiki page on it. There is some abstract explaination on the matter.
For more concrete implementation take a look at the Zend package wich I use to build REST services.
I have always used the Zend_Rest libraries when trying to accomplish this task. They are pretty easy to implement and pretty well documented.
Zend_Rest

Is it possible to programatically extract a spotify playlist?

I have done a load of searching but haven't found anything. There seem to be a lot of jobs asking for this functionality yet no one really talking about whether / how it can be done.
Does anyone know if this is possible and if so where I could extract the data from?
Check the official libspotify documentation and more specifically the playlist subsystem.
Note that this is a C API, not PHP.

php of jquery to access solr?

im a beginner in using solr.
i know that you can either use ajax solr or solr-php-client to get the search results from solr.
but which should i use or are there occasions you have to choose one of them?
for example, which one is a better solution for autocompletion and which one is better for search content in threads?
would appreciate if someone could shed a light on this.
Use PHP (or another server side language) for essential functionality.
Use client side JS for optional extras.
Build on stuff that works.
If you use SolrJS you're exposing your Solr instance to the world, so you need to make sure you disable the update handler. With solr-ajax you can set up a proxy to avoid this.
See Security concerns for details, also: http://wiki.github.com/evolvingweb/ajax-solr/comparison-to-solrjs
For auto-completion, AJAX is the only valid option. As for searching threads, either way would be acceptable.

Categories