Welcome Guest, Not a member yet? Register   Sign In
How do I upload a file with CURLRequest?

I am unable to implement a curl call using the library. I'm trying to write the following command using the library:
curl -i --upload-file /Users/peter/Desktop/superneatimage.png --header "Authorization: Bearer redacted" 'https://api.linkedin.com/mediaUpload/C5522AQGTYER3k3ByHQ/feedshare-uploadedImage/0?ca=vector_feedshare&cn=uploads&m=AQJbrN86Zm265gAAAWemyz2pxPSgONtBiZdchrgG872QltnfYjnMdb2j3A&app=1953784&sync=0&v=beta&ut=2H-IhpbfXrRow1'
If you are interested in the documentation, here is a link. I'm trying to share an image and stuck on the upload part. This is what I have tried and I am getting all sorts of errors. Mostly bad requests but from time to time I would get an ssl error

PHP Code:
$client = \Config\Services::curlrequest([], nullnullfalse);
                                    try {
                                        $response $client->request('post'$uploadURL, [
                                        'headers' => [
                                            'Authorization' => 'Bearer ' $Social->AuthorizationToken,
                                            'X-Restli-Protocol-Version' => '2.0.0',
                                            'Content-Type' => 'multipart/form-data',
                                        'multipart' => [
                                            'upload-file' => new CURLFile(realpath("absolutepathtoimage.png"), "image/png""imagename.png"),
                                        'verify' => false
                                    } catch (\CodeIgniter\HTTP\Exceptions\HTTPException $e) {
I am inclined to just use plain curl. Perhaps this library is just not mature enough?

Theme © iAndrew 2016 - Forum software by © MyBB