Lately, I was given the task to write some php classes with Laravel that make use of Zencoder api. The way Zencoder works is I create a new encoding job and during that request I tell Zencoder emails and url locations to send notifications when that job is finished.
So if I make a Guzzle request to Zencoder
$data = [
Once this job completes encoding the video, I should expect to get a notification sent to my email address and also Zencoder will send a POST with the job output data to my
http://localhost:8000/api/notifications/zencoder is not a valid url to ping so Zencoder ends up throwing me a HTTP error - 422 Unaccessible Entity.
Now I can use ngrok to create a proxy site for my local server. When developing I don’t use apache or nginx, rather I just serve files using
php artisan serve
This gets me a site up I can access on http://localhost:8000. The next part is to just run
I’m ready to go now. This gives me a site like
Now I can
dd(Input::all()) in the controller for the route
/api/notifications/zencoder and see what sample data I should expect from Zencoder. Later I found this in the docs but it’s nice to be able to test the real deal.
This also gives programmers the ability to show clients the real site without setting up a staging server. It’s super easy. ngrok is what I settled with but there are other applications that accomplish the same thing. Here is a list.