Catch forced download using CURL PHP - php

So apparently Facebook recently (I think it is as of today) started to force download a profile picture when looking it up using the following url: graph.facebook.com/{FBID}/picture?type=large. Before it just showed it in the browser. This breaks some of the behavior of my app. I.e. all of the profile pictures are not loading anymore.
So I thought I might just run over the complete database; downloading all the pictures using PHP and uploading them to my server. But I don't understand how to do this. I do understand how to download and upload a 'normal' .jpg or .png file or whatever using Curl in PHP. But since this URL ends up downloading the picture (check it for yourself using a random FBID with the above mentioned URL) I do not know how to 'catch' it - so to say - and upload it to my server.
I know it would be also possible to just use the User Picture Graph. But since the database is quite large, a part of the access_tokens expired. So I would end up with just a part of al the profile pictures.
Also, has someone any idea why Facebook changed this behavior (and not announced it in advance). I could not find it anywhere. Thanks

Related

How to get actual image from local path in PHP?

Disclaimer - Thanks for coming to this question! I would just like to say that I am an absolute beginner to PHP. Thanks!
Hi! I am working on a project (more specifically, a mobile-only App), in which I need to do the following things -
The user would give me his/her phone's path to the image, which is stored in his mobile.
Through API, I would send the path to my website's PHP file, and the PHP would capture the image from the path.
After displaying the image, the code would compress it with very high compression, and display the temporarily store the image.
Then I would upload the image to AWS S3 media database(maybe with PHP SDK?), and obtain the image's link.
So that's my plan, is it possible to do? And what are the steps to do the 2nd & 3rd step - i.e. catching the image from the phone's local path, and compressing it?
Any help is appreciated :)
Thanks a lot!
There is no possibility for you to remotely access any known mobile operating system's storage.
You want to upload a photo and process it - just do it! You can simply send the photo through your API to the PHP server, and it would receive it as it would receive any other file, e.g. from a website form.
Then, you use some tool like Imagick to edit the photo.
You return thumbnail to the user within the response of your API.
Yet simpler, isn't it?

Prevent to download PDF, Video file using PHP

I am showing PDF, Video file preview in my web application, but i want to give only read access to users, no one can`t download PDF & video files, I want to prevent users, how can we prevent users to download it using PHP ? only they can view, please share you ideas as soon as.
Thanks
Any content that is shown on the client's side, technically speaking, already downloaded to the user's machine. If the user is seeing the PDF file - it's already been downloaded.
For video: it's not that straightforward, you can organize a streaming of the video. It'll be fairly more complex for the user to download it as one file, but still, can be captured.

How to post images to users' wall (or in folders/albums) on Facebook (2013)

I am using Facebook's PHP SDK. I looked here (official documentation by Facebook) for help. It is not working for me because I am using images hosted externally but if I try to upload files hosted within my server then it works fine.
Is there any new way to do this. Please try to explain both (Posting to feed and to some folder/album). Sorry for this question but others here were of no help to me.
Please suggest any PHP editor that is compatible with Facebook's API. (Auto-completion etc.)
Stack is normally for solving small issues (think using = rather than > in a query) not a complete project.
Have you attempted writing this code yourself, if so what errors is it spitting out? rather than saying it doesn't work.
If the images are stored somewhere out there, you need to download them to your server and upload them to FB. You can't just tell FB an URL of an image, it's not working like this.
In order to upload fotos, you may use the "photo post" Method on the FB API. And it wants the binary data of the image. You may link an input and an output stream to that (what I would prefer using Java since no storage is needed).
Since your code is working with locally hosted images, just encapsulate that part and make the external image an internal one first.

Protect audio file from being downloaded while still being playable through JQuery JPlayer

I have audio files saved in a folder on my server. They are called by JQuery JPlayer to be played. However if a person looks at the source of the page, they can find the location of the file and simply download it. I want to protect the files from being downloadable, but still allow JPlayer to play them. Is this possible?
I have tried denying the folder with .htaccess as well as password protecting the folder, but this prevents JPlayer from being able to play the files.
It's impossible to stop a savvy user stealing your media. But if you like, you could
use oAuth to govern access to the media resource
teach your server to only respond to media requests that contain "special" HTTP Headers, Cookies etc.
use DRM (washes mouth out)
some other URL obfuscating/expiring method you dream up..
To save time, i suggest you accept whatever you publish can be copied / taken. So, why not publish
a sample snippet (e.g. the first minute)
A lower-bitrate / mono taster version
Recently, a widget allowing you to stream Paul McCartney's new album was published in the Guardian.. how this is "secure" i don't know, I opened Chrome Dev Tools Network tab and helped myself to anything "audio/mpeg"!
I found a possible answer for you, using PHP:
Solution using PHP sessions
It's a long thread, but there's code there that will help you.
You should be aware (just in case you're not) that if someone can play the file in their browser, there is nothing to stop them playing the file and using recording software to capture the audio.

Vimeo PHP Upload Directory

I have spent this best part of a week rattling my brain to get this working and I've just come to the conclusion that this is out of my scope. I know this is a rather large ask but I just can't figure it out. :(
Anyway, I am trying to upload some files in a directory on my webserver to Vimeo through a protected php script (I say protected because the script itself will not be accessible from the web) and have that script run via a cron job. The script will only upload to my account.
I have gotten as far as getting a consumer key and consumer secret from vimeo.
I have been attempting to use their documented API demo but that keeps requesting an oauth_token and oauth_token_secret, both of which I don't know how to obtain. I found it quite confusing and unsure if I could adapt it for my requirements. Instead, I googled and found this blog post about transfering files from youtube to vimeo - http://mclear.co.uk/2011/05/27/transfer-videos-from-youtube-to-vimeo/ - I thought I could use it as a building block but I've hit a dead end here also.
To explain the full scale of what I'm trying to achieve:
Video file is created on originating computer - Working
User adds ID3 tags to the file and drops it in a watched folder - Working
Local server sends the file via ftp to the webserver directory - Working
Php script reads the ID3 for the file and uploads it to vimeo - [ID3 Extractor working -Vimeo uploader not working]
Vimeo responds with upload location to script which then connects to our mysql server to add the record - Not working but straightforward to implement once uploader works
Thank you so much in advance for any help you can give.
Richard
I made some progress on this with the php "Transfer Youtube to Vimeo tool" I made
The download at the bottom of the article will get you uploading w/ PHP
The CLI tool is now available and comes with a video tutorial for how to use it.
Credit to #TomNomNom
Please don't contact me RE this I'm not supporting this code it was just hacked together :)

Categories