Caracorn

Caracorn

Member Since 3 Years Ago

Experience Points
670
Total
Experience

4,330 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
670 XP
Mar
26
1 week ago
Activity icon

Started a new Conversation Upload An Image To A Webservice Using Lumen + Guzzle 6

Hello,

I want to upload an image to a external web service using Lumen + Guzzle 6. The external web service does not accept "base64-encoding" the image to be sent. Only the image file is accepted as such.

But I still get an error that the image could not be found or rather Guzzle sent the request without the image, although the function file_exists() could find it.

If I work with cURL-command-line on the console, it worked fine for me:

    curl -v --user "username:password" ...

Thank you very much for every hints, why Lumen & Guzzle6 can't do it.

Here a bit of the code:

    $filename_with_path  = storage_path( 'app/pics/') . $file_name;        
    $fileContent         = File::get( $filename_with_path );
    $mime_type           = File::mimeType( $filename_with_path );
    $this->guzzle_client = null;
    $this->guzzle_client = new Client( [
        'auth'      => [
            'username',
            'password'
        ],
        'multipart' => [
            [
                'name'      => $file_name,
                'filename'  => $file_name,
                'contents'  => $fileContent,
                'mime-type' => $mime_type,
                'headers'   => [ 'Content-Type' => $mime_type ]
            ],
        ],
    ] );



    $this->response = $this->guzzle_client->request( 'PUT', $uri.$endpoint );
Jan
08
2 months ago
Activity icon

Replied to LUMEN-API Sending Images As Direct Data (octet-stream) Not Possible?

Is there no possibilities to realize that with LUMEN?

Jan
06
2 months ago
Activity icon

Started a new Conversation LUMEN-API Sending Images As Direct Data (octet-stream) Not Possible?

Hello,

I want to create an API in Lumen.

With the API the users could upload images. After uploading a image, the API should forward this image to another external webservice by sending this picture as direct data (octet-stream) with appropriate MIME Content-Type header.

How can I deal it with Lumen API? Is there maybe a out-of-the-box-feature for that in Lumen?

Thank you very much.

Oct
07
5 months ago
Activity icon

Replied to Super Function For Json Response

Thank you! I'll try it

Oct
06
5 months ago
Activity icon

Replied to Super Function For Json Response

I tried ... but without recursion.

It seems to work for a 3rd level depth of JSON structures .... you could continue to push the game for more levels.

$ar = json_decode( '

[
  {
    "id": 111,
    "ref": 123435,
    "art": [
      {
        "id": 1,
        "wood": "Bayer",
        "land": "Germany"
      },
      {
        "id": 2,
        "wood": "Huyu",
        "land": "China"
      },
      {
        "id": 3,
        "wood": "Lupo",
        "land": "Netherland"
      }
    ]
  },
  {
    "id": 222,
    "ref": 222222,
    "art": [
      {
        "id": 1,
        "wood": "Sapa",
        "land": "Vietnam"
      },
      {
        "id": 2,
        "wood": "Rake",
        "land": "USA"
      },
      {
        "id": 3,
        "wood": "Sowi",
        "land": "Russia"
      }
    ]
  }
]

', true );

echo '

';
print_r( $ar );
echo '
';

function loop( $json ) { if ( $json !== null && is_array( $json ) ) { foreach ( $json as $value1 ) { if ( $value1 !== null && is_array( $value1 ) ) { foreach ( $value1 as $k1 => $value2 ) { if ( $value2 !== null && is_array( $value2 ) ) { foreach ( $value2 as $k2 => $value3 ) { if ( $value3 !== null && is_array( $value3 ) ) { foreach ( $value3 as $k4 => $value5 ) { echo "$k4: " . $value5 . ''; } } else { echo "$k2: " . $value3 . ''; } } } else { echo "$k1: " . $value2 . ''; } } echo '-------------------------------------'; } else { echo 'Value of 2. level: ' . $value1 . ''; } } } else { echo 'Value of 1. level: ' . $json . ''; } }

loop( $ar );

Activity icon

Replied to Super Function For Json Response

After a long search, I finally found the solution ... but it is coded in Python. One would have to translate all the intelligence of the solution to PHP.

PHP experts?

https://towardsdatascience.com/how-to-flatten-deeply-nested-json-objects-in-non-recursive-elegant-python-55f96533103d