reddit API - Pulling images from subreddit - php

I'm looking for examples in reddit API. I want to pull images from a certain subreddit (http://www.reddit.com/r/VillagePorn) and put them on a webpage. I've seen other websites do it (mainly, imgur.com/r/*) and I can't figure out how.
I tried http://www.reddit.com/r/VillagePorn/.xml but that just returns the Thumbnail of the picture. Not even the link itself.
What should I do?

You can check out the Reddit API if you'd like. Any link can add /.json to the end of it and it fetches the information for that, including the source link for the picture.
I'm not sure how you're creating this page, but this question might help you out too.

Related

How to embed links from websites which use the og tag? PHP

I have a Social Networking website and I wanted to know how i could get the content from a websites OG tag. Like how Facebook embeds links into their website. I Only want to get the title,img,desc and nothing else then embed that link into my website. I used regex to validate if its a link and if it was post it in a link, Nevertheless i dont know how to embed the links :) I would really like if someone Could help. Also the code which i have does this :
Just saves the post to the database
Shows the posts from the database (After detecting if its a link,video,image,gif...)
This is my first post on stackoverflow, I really do apologize if i didnt give good info. If you would like some info

How To Read Vimeo RSS Feed Using PHP

I want to read the rss feed for my videos from Vimeo using a PHP script so I can update a database table with video data, however even though I can read the feed in my browser, Vimeo returns a 500 error.
I looked at their API documentation which is about as clear as mud and wants me to create an API. I don't want an API for visitors to use, I just want to read a feed (which would normally be simple using curl.
I haven't found any help at all from their documentation, hopefully someone could make it a bit clearer for me please.
Thanks in advance.
I finally managed to resolve this. Feeling rather dumb now, the content of the curled rss feed from Vimeo did not display on the screen when echoed because of some of the content. It was however returned. I needed to view the screen source to see the content.

facebook embeded post with comment

I created a website than can post from my website to facebook using embeded post
https://developers.facebook.com/docs/plugins/embedded-posts
My problem is I need to get all the comment of that certain post.
I've read about the comment plugin
https://developers.facebook.com/docs/plugins/comments
but i don't think that it can solve my problem since it will only give me a comment box for my website, not the comments from their post.
how do I get all the comment of that embeded post? can someone give me a link that might help? thanks.
You have to use the proper Facebook Graph API supplied for web developers to embed and manipulate Facebook content in their applications.
Read the specific documentation here.
EDIT: This is the PHP SDK here and the Reference Documentation, with classes you may use to achieve what you want here. Read it all, understand how to implement it in your project and you'll be up and running.

How to find out if a user click a video to play it

I run ads on my site which are usually YouTube videos. I would like to find out if a user clicked these videos. I'm basically trying to use this data in a statistics plugin that I'm creating.
I've tried searching many different keywords but I can't really find anything.
I would appreciate it if I could be pointed in the right direction. Any ideas, hints or links are welcomed.
As you mention YouTube I doubt you have control over the URL.
But, if you can control the URL embedded in the video, then I would suggest building a simple redirect script on your server. Make sure the URL contains either the redirect URL or a code representing the URL which would be held in your Data Base. Add a logging function to the redirect script and hey presto.
If you have no control over the URL, then off the top of my head maybe you could implement some client side JS to add an overlay to the video which becomes the click-able element and implement the URL redirect script above. Some methods to get the URL from the video: https://www.google.com/search?q=jquery+youtube+URL

Facebook link inspector

I'm building a website and am looking for a way to implement a certain feature that Facebook has. The feature that am looking for is the link inspector. I am not sure that is what it is called, or what its called for that matter. It's best I give you an example so you know exactly what I am looking for.
When you post a link on Facebook, for example a link to a youtube video (or any other website for that matter), Facebook automatically inspects the page that it leads you and imports information like page title, favicon, and some other images, and then adds them to your post as a way of giving (what i think is) a brief preview of the page to anyone reading that post.
I already have a feature that allows users to share a link (or URLs). What I want is to do something useful with the url, to display something other than just a plain link to a webpage, to give someone viewing a shared link (in the form if a post) some useful insight into the page that the url leads to.
What I'm looking for is a script, or tutorial, or at the very least someone to point me in the right direction, so that it can help me accomplish this (using PHP preferably).
I've tried googling it but I don't know exactly what such a feature would be called and google isn't helpful when you don't exactly know what you're looking for.
I figure someone out there, in this vast knowledge basket called stackoverflow, can help me with this. Can anyone help me?
You would first scan the page for URLs using regex, then you would parse the pages those links reference with a php DOMDocument. You could use the parsed document to obtain any information you need from the webpage.
DOMDocument:
http://php.net/manual/en/class.domdocument.php
DOMDocument->load (loads a file, aka a webpage):
http://php.net/manual/en/domdocument.load.php
the link goes through http://www.facebook.com/l.php
You pass a URL to this and facebook filters it.

Categories