I am attempting to use the Gallery3 REST API to upload an image. According to the limited API documentation I should be posting new items to this endpoint /index.php/rest/item/1.
Documentation: http://codex.galleryproject.org/Gallery3:API:REST#Example_create_request
Can anyone confirm this because I keep getting failed to open stream: HTTP request failed!
I am able to connect to the gallery, get member albums, and get photos. I just can't seem to upload new photos to the gallery.
Yes, that is the correct URL. I was able to create an album by posting to that URL using Postman. My error seems to have something to do with my PHP ... specifically something to do with stream_context_create() and/or file_get_contents().
Related
Can you guys please help me to debug the issue?
we have integrated new Instagram API in our site
the get user media endpoint gives all the data as it should and gives permalink of the image some thing like this.
[permalink] => https://www.instagram.com/p/BhPF_wIF_LdKPD50yRBIziXRuNxoozgkbTfTNQ0/
So now we want low resolution ,medium resolution images url so we send a PHP curl call to this link
https://www.instagram.com/p/BhPF_wIF_LdKPD50yRBIziXRuNxoozgkbTfTNQ0/media/size=t
When we browse this link it's returning an image fine with redirected link of something like this:https://instagram.flhe5-1.fna.fbcdn.net/v/t51.2885-15/e35/c0.135.1080.1080a/s150x150/100892861_961026034341512_1655134161295915987_n.jpg?_nc_ht=instagram.flhe5-1.fna.fbcdn.net&_nc_cat=108&_nc_ohc=c2ziC3PLbasdskAX82Pknl&oh=7b0f92ea582a88412471794c51ec6020&oe=5F722E4
we want this redirected link using curl call but somehow curl info returning HTTP code 404 every time. https://prnt.sc/u6uw8l so we can't get effective url through curl.
would be grateful if you guys could debug what could be the issue here.
Thanks!
Let's imagine that I have a video url on my site: it's like this: http://example.com/videos/myvideo.mp4 . I want to use Automatic (“pull”) uploads method to upload this video to vimeo. Then I simply want to host it on my site. The problem is that the documentation that they provide is kinda confusing to me (and possibly all other developers getting started with their api). So, from your experience can you tell me how to upload this video to that vimeo and get back the video url that has been uploaded?
I created the vimeo app as they said and I have requested the upload access. It says:
Upload Access
Approved for the following accounts:
Your account
So basically everything is setup. I just need to know what http request should I send to the vimeo server in order to upload that mp4 file that is accessible on the web.
The HTTP request is detailed in the pull upload section of the documentation: https://developer.vimeo.com/api/upload/videos#automatic-pull-uploads
An HTTP POST request to https://api.vimeo.com/me/videos with two required, and one optional parameter sent through the request body.
The official PHP library: https://github.com/vimeo/vimeo.php will help you make the upload request, and documentation on making requests using this library is located here: https://github.com/vimeo/vimeo.php#make-requests
Once you have all the pieces together, the request looks kind of like this:
$response = $lib->request('/me/videos', ['type'=>'pull','link'=>$url], 'POST');
Im using the PHP example code given in Youtube API v3 : https://developers.google.com/youtube/v3/docs/captions/download , to download captions from 3rd party, publicly available YouTube videos in my webapp i.e. I have NOT uploaded the content on Youtube.
I am able to get access to the list of caption tracks, but unable to download the caption using the caption track ID from the received list.
The error that shows up upon attempting to DOWNLOAD is:
Error calling GET https://
www.googleapis.com/youtube/v3/captions/Lw0e5xDNU17GFafOl8DcyeOtwzWJTf9V?tfmt=srt&alt=media:
(404) Not Found
(I have tried removing tfmt (optional parameter), but still gives an error.)
But the error is different for attempting to DELETE captions:
Error calling DELETE https://
www.googleapis.com/youtube/v3/captions?id=Lw0e5xDNU17GFafOl8DcyeOtwzWJTf9V:
(403) Forbidden
Therefore it seems that captions.download is NOT forbidden for users other than owner (just like the captions.list is NOT forbidden) and therefore I would like to use this data for my webapp.
Any help is gratefully received.
Thanks,
Nikhil
I just tried the URL you mentioned in a browser and in the API explorer, and in both cases I received a 401 when I had no oAuth token and a 403 when I had an access token (since I'm not the owner), so the endpoints are acting as intended; according to the documentation, downloading captions requires oAuth consent from the owner of the video.
Perhaps, if you're getting 404s instead, there's a problem in the PHP library?
I have found another way to access any YouTube video's caption data.
The code is written in Ruby.
Read Youtube transcript (captions) from any public Youtube video
Works great, I just need to find a way to integrate this with my webapp.
I have video files stored on my web server which I want to be able to upload to YouTube in an automated kind of way. These videos are created on my website, which then the user can just upload to their YouTube Channel.
I am trying to make HTTP request calls to automate this video upload process, according to the Resumable Video Upload process here: https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads
Everything works fine (getting the user's access permission, sending the metadata of the video) until the final step, which is the upload of the video itself. When I make the PUT request, it returns a response code 417 and says Invalid Request. Like this:
The following error was encountered:
Invalid Request
Some aspect of the HTTP Request is invalid. Possible problems:
Missing or unknown request method
Missing URL
Missing HTTP Identifier (HTTP/1.0)
Request is too large
Content-Length missing for POST or PUT requests
Illegal character in hostname; underscores are not allowed
I took a look at all those suggested possible problems, but I cannot find a fault anywhere in my code.
And the error message is just to vague and not specific enough to tell me where the problem is.
I am performing every step of the video upload process using the PHP's standard Http Request class. (http://www.php.net/manual/en/class.httprequest.php)
Here is my code:
$videoFile = *Some Video File*;
$httpRequest = new httpRequest($_SESSION['youtube_data_api']['upload_url'], HttpRequest::METH_PUT);
$httpRequest->setContentType('video/mp4');
$httpRequest->setPutFile($videoFile);
$headersArr = array('Content-Length' => strlen($httpRequest->getRawRequestMessage()));
$httpRequest->setHeaders($headersArr);
$httpMessage = $httpRequest->send();
I dug around on the internet a lot regarding this question, and a lot of times what I found are people using the Zend framework's YouTube library to accomplish this instead, which is a lot easier. Unfortunately, with the size of my website right now, it is just not feasible to spend some much time trying to integrate framework into my website.
Any insight into this problem would help tremendously! Thanks!
I'm building a site on which users can share YouTube videos. Therefore I need to fetch a thumbnail from the youtube servers by using the imagecreatefromjpeg function of php. Unfortunately, this does not work with every video. Some videos only result in this error message:
Warning:
imagecreatefromjpeg(http://img.youtube.com/vi/GY0wbp38REk/0.jpg)
[function.imagecreatefromjpeg]: failed to open stream: HTTP request
failed! HTTP/1.0 404 Not Found in ....
My script checks from 0.jpg up to 4.jpg whether a thumbnail is available, but there seems to be no thumbnail for certain videos.
How can I get the thumbnail of these videos?
Instead of guessing the address to the video, you have to use the oEmbed data they provide. Query http://www.youtube.com/oembed?url= with the path to the url (watch?v=...) and parse the response, they provide thumbnail_url