Pull facebook data xml - php

http://developers.facebook.com/docs/reference/rest/links.getStats/
Okay I have looked at the site above. but im still having some trouble.
I have formated what I need like this
http://api.facebook.com/restserver.php?method=links.getStats&urls=dogtags.com.com,http://www.petsmart.com
My only issue is I need this data to be picked by the zip code another words I only want to see how many likes are on the url http://www.petsmart.com in the zip code 66614. How can I add that variable to the xml data displaying
Thank you all help is greatly appreciated

You are using an outdated facebook API. I would recommend implementing:
http://developers.facebook.com/docs/reference/api/insights/
However, I do not believe there is any way to to look at data from a specific zip-code using the facebook insight API

Related

Extract from DB to XML

I have made a website where users can choose some regions on Google Maps, and save them into a database with a name an a description. What I need now is to be able to take the saved entries from my DB and show them also to an android app I have made with google maps. I am new to all these and from my research I understand that I should extract my data from the DB to an XML file and then parse them on the phone. For doing the first part I should use the following code, if I am not mistaken:
SELECT column1, column2,..
FROM tablename
FOR XML PATH;
What I still dont get is where should I put that piece of code? In a new file? All by itself? And with that code the XML file will be created, or should I do something else too?
Thank you
Well since noone answered my question and I did find the solution I'll post it here.
The answer is via PHP, XMLWriter. There is a question here that helped but I wasnt able to find from the beginning since I didnt know what to search for.

Need advice about making a forum with php

I am trying to create a forum on my page. I need some advice. I have MySQL database and I am able to to work with it. Yet as far as I can make is playing with POST. I mean on click submit a $_POST['submit']) becomes set and so on. Then connect to database, get info and display.This way of making a forum is bad, because it all happens on a single page. As far as I seen any other forum when entering one and so on has it's unique Uri (what comes after domain.com/) so you can simply send someone full url and they are in that thread (unlike if you play with $_POST['submit']).
Sorry if my question is not accurate and I am not asking to write me code. I just need someone to direct me to the right place and any advice would be helpful. Thanks !
Your question is difficult to understand, but I think you are confused about how data and pages are dynamic using GET/POST.
The URLS with different IDs are like an illusion. Really, its the same page, however the page is dynamically taking that ID from the URL, and using it to output certain data.
For example, say we habe the URL: www.example.com/show_thread.php?thread=3
The php would look like
if(isset($_GET['thread'])){
$data = $db>query("SELECT thread_title,thread_text FROM threads WHERE thread_id = $_GET['thread']");
print($data);
}
*Warning: do not use this exact code, it is an example, not secure, etc
Then the database would look like
thread_id thread_title thread_text
1 kngwihywoihwy kngwihywoihwykngwihywoihwy
2 vyfngoieyoiehyon ieonuwrtoi hunwrmt jirwyji
3 nuoaiefguneoihn eoithneiotheo
and the page would show
nuoaiefguneoihn eoithneiotheo
POSTing data is for sending it to the server, and doing something with it. Just like GET. However, GET is helpful for passing things around as they are accessible in links. Like this example.

API Integration with website

i have been assigned to integrate an API in a blog.
API URL:http://www.ask-oracle.com/charts/api.php?dt=2015-10-19T08%3A48%3A32%2B05%3A30
I am able to get the data using
$data = file_get_contents('http://www.ask-oracle.com/charts/api.php?dt=' .$date .'T08%3A48%3A32%2B05%3A30');
But not able to organize it properly.
It returned JSON array, i need your help in getting out the data and show properly(organized way) in my blog.
Please help me, how i can do it.
I will be very thankful to you if you provide me code(in html or php) also.
This is up to you to decide how to organize this. As #steve suggested it, you should convert the JSON stream to a PHP object, and then transform it to HTML to "organize" it for humans who are not able to read JSON. It will surely also involve CSS.
If somebody asked you this work but didn't gave more informations about how to display it and you have no idea about how to do it, you should maybe ask for more precise specifications before starting the work.
Note that saying that JSON is not properly organized is not exact. JSON is a structured data notation.

How do I retrieve data from google using PHP

In PHP, I was wondering how to retrieve specific data from a google search. For example if I wanted to retrieve the price on https://www.google.com/#q=ps3&tbm=shop for the first result. I have experimented with curl and domdocs and am not going any where.
The simplest way to get the contents of a webpage in PHP is to use the file_get_contents function.
http://us2.php.net/file_get_contents
Once you have the data, you'll need to parse it. There have been plenty of great articles about how to approach this, so I'm not going to repeat them. Here's a link to a good one:
http://anchetawern.github.io/blog/2013/08/07/getting-started-with-web-scraping-in-php/

Grabbing reddit comments and archiving them in a database with php

so I know basic PHP, I coded a basic mysql/php inventory system awhile ago. I want to get more experience. My idea is to grab reddit comments, display them on a page, and then save them in a database. My problem is I don't know how to grab and make sense of JSON data.
For example, here is a JSON link to a reddit thread: http://www.reddit.com/r/blog/comments/117ckb/introducing_three_new_hires/.json
Goal:
INPUT BOX -> reddit unique thread id in input box (http://www.reddit.com/r/blog/comments/<6 digit unique ID>) -> loads reddit comments on the page
That's my current goal, would really appreciate a nudge in the right direction with processing JSON. I know I COULD just Google it, but I'm posting in hopes of someone having experience with the above and offering their expertise on the topic.
Here's a starting point:
$download=json_decode(file_get_contents('http://www.reddit.com/r/blog/comments/117ckb/introducing_three_new_hires/.json'));
foreach ($download as $articles){
foreach ($articles->data->children as $article){
print_r($article);
}
}
Please note: I recommend using Curl instead of get_file_contents() - it's a lot faster!

Categories