Uploading Videos in Graph API - php

I'm putting together an application in facebook, part of which requires a user to input a bunch of information into a form, including a video and a number of text fields.
For my application, I'm using a combination of HTML, PHP, mySQL and Javascript.
I want to be able to upload the users video file to facebook using the PHP SDK in the same page as I am inserting their info into my database. I want something similiar to the photo solution here: Exception when uploading photo with Facebook Graph API. But I'm not sure what the array key should be for the video itself.
Can any give me any ideas?

My apologies,
I realized that the solution I linked to works. However, you have to give facebook time to process the video, otherwise the graph api replies false.

Related

Android app how to get photos of a specific user

I'm creating a social app similar to instagram on Android studio.
Users will be able to upload and view photos in this app.
The photos are saved on a Cloud in a folder called "ProfileImage" and the URL of the photos is saved on the MySql database, along with the ID of the photo and the user's ID.
To get the photos I would like to use Picasso.
If for example the user A wants to look at his photos, the app will have to show him only his photos, that is I will have to get the URLs of the photos that have the id of the user A.
Picasso to get the photos use the following code Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(imageView);
But the problem is that I don't know the specific URL of the photos.
One solution I thought of is to get the URLs of the photos via PHP and pass them into an android variable that I will use as a URL variable for Picasso.
But this solution seems slow to me, in the sense that the photo will not be displayed immediately, but seconds will have to pass.
Can anyone recommend a faster and perhaps better solution than mine?
First of all, Upload your image to server and save image url inside mysql database not image itself. Create one api that returns user info including image url.

Duplicate video when upload via youtube api

I'm using Youtube API v3 to upload video. At the first time I use, it requires authorization then do upload but there are two videos is created. They are exactly the same but there is no error, the API returns the latest id. I checked in my channel, two videos could be view.
When I try to upload the previous video, another id returns, too, but if I use this, Youtube will show me "This video is a duplicate of another video". Other times, the API works right. Did anyone encounter this problem?

Youtube retrieve/embed

Is there a possible way where I can retrieve a list (with thumbnails) of my latest videos from youtube, store the embed code in a database using a cron job so I can show the video on a separate page instead of leading the users to youtube to view the videos? (all in php)
you can try to have a look at this page: https://developers.google.com/youtube/v3/
Google writes that:
You can use the API to fetch search results and to retrieve, insert, update, and delete resources like videos or playlists.
I saw thath PHP API are still in beta version but you can try it out. You must register your application to obtain credential to use API. At developers.google there is a lot of documentation and some examples (https://developers.google.com/youtube/v3/code_samples/php#retrieve_my_uploads)
Using API you don't need to retrieve code and store it into database, you can just show videos directly in your web application. I hope this is what you was looking for let me know if it helps!
Luca

Get Facebook images based upon a description

I need to create a program which allows to store photos of which people has uploaded in Facebook based on the photo description. For example, I upload/post on Facebook a picture with the description "#awesomeevent" the program should be able to store this particular image into the database. Twitter has hashtags but Facebook do not any where which i can work around this ?
I was thinking of using a FQL query but unsure how to do it.
The best (and only?) way to do this imho is to include the hashtag in the message of the photos and read it from there. I would not use FQL for that, because there is no need to use it. The Graph API offers enough possibilities/connections to read photos:
https://developers.facebook.com/docs/reference/api/user/
(/me/photos, /me/photos/uploaded, /me/albums, ...)

How to use Facebook PHP API to upload a photo to wall without file POST? (Using a URL maybe?)

I'm doing preliminary research for an upcoming project. Basically here is the user/data flow:
A webcam at an event takes pictures and sends the photos to a local server
A brand rep has an iPad with an app (developed as an HTML app saved to iPad home screen as an app). The app displays all photos from the local server as thumbnails via simple AJAX calls to load them into the view.
A user selects a photo. That photo will be sent from our local server to our remote server. The remote server will host a Facebook iFrame tab with the user selected photos.
At the same time, a link to the iFrame tab with a query string will be posted on the user's Facebook wall and Twitter (if they choose to authenticate of course).
Now the tricky part, we are 99% sure that the client is going to want to also upload the photo directly to the Facebook user's album. Possibly to TwitPic as well but that is a secondary concern. So my question is, is there a way to use PHP to upload a photo to a Facebook wall without using a typical html file input field and POST? Ideally, if we can do some kind of a file_get_contents on the photo URL from the local server and use PHP/FB API to upload the contents of the photo URL, we'd be in great shape.
The goal is to have the photo uploaded to the user wall with a caption like:
Check out my photo taken at _ event! [URL to client facebook tab with photo id].
#jeremyharris is right to say that Facebook's PHP SDK wraps cURL. You indeed need to use cURL to post a request to Facebook's API endpoint. Though, start by reading http://developers.facebook.com/docs/reference/api/ Publishing section to understand the mechanics before you jump onto their SDK.
Then familiarise with the feed object. You can use either it or the photo object to upload the photo.

Categories