G2A Many GEOs
SHARE
TWEET

Untitled

a guest Mar 28th, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function create($request)
  2.     {
  3.         ini_set('max_execution_time', 2180);
  4.  
  5.         $file       =   $request->file('image');
  6.         $file_path  =   $file->getPathName();
  7.         $fileName   =   $file->getClientOriginalName();
  8.  
  9.         $req = $this->client->post($this->url.'articles', [
  10.             'multipart' => [
  11.                 [
  12.                     'name'     => 'image',
  13.                     'contents' => fopen($file_path, 'r'),
  14.                     'filename'=> $fileName
  15.                 ],
  16.                 [
  17.                     'name'     => 'title',
  18.                     'contents' => $request->title
  19.                 ],
  20.                 [
  21.                     'name'     => 'tags',
  22.                     'contents' => $request->tags
  23.                 ],
  24.                 [
  25.                     'name'     => 'article',
  26.                     'contents' => $request->article
  27.                 ],
  28.                 [
  29.                     'name'     => 'category_id',
  30.                     'contents' => $request->category_id
  31.                 ]
  32.             ]
  33.         ]);
  34.  
  35.         $response = json_decode($req->getBody()->getContents());
  36.         return $response;
  37.     }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top