Git Product home page Git Product logo

Comments (2)

aaronm67 avatar aaronm67 commented on August 30, 2024

I think this is probably a case where it makes the most sense to just use curl directly rather than go through the library - this is an edge case that would be a little confusing to use within the library. You can see how the Vimeo library does this with vanilla curl_{x} calls, https://github.com/vimeo/vimeo.php/blob/master/src/Vimeo/Vimeo.php#L541, or there are many different curl wrappers you can use.

from vimeo.php.

fuad-tareq avatar fuad-tareq commented on August 30, 2024

Thanks for your quick response @aaronm67. I've actually been trying curl all day unsuccessfully.

EDIT:

Upon further inspection of the Vimeo PHP SDK, I've come up with the following curl settings that finally did the trick:

$curl = curl_init($uploadLink);
curl_setopt_array($curl, array(
  CURLOPT_URL => $uploadLink,
  CURLOPT_HEADER => 1,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CUSTOMREQUEST => 'HEAD',
  CURLOPT_SSL_VERIFYPEER => true,
  CURLOPT_SSL_VERIFYHOST => 2,
  CURLOPT_HTTPHEADER => array(
    'Tus-Resumable: 1.0.0',
    'Accept: application/vnd.vimeo.*+json;version=3.4',
    'User-Agent: vimeo.php 3.0.8; (http://developer.vimeo.com/api/docs)',
    'Authorization: Bearer [token]'
  )
));
// Separate the header from the body.
$headerSize = curl_getinfo($curl)['header_size'];
$headers = substr($result, 0, $headerSize);
$body = substr($result, $headerSize);
curl_close($curl);

I had some trouble getting this to work initially, maybe it will save someone some time guessing. I'm leaving this here as a sample for anyone else who may need this in the future.

from vimeo.php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.