Category Archives: PHP

Parsing a GET request in PHP with an Azure Function

While playing around with PHP (experimental support) in Azure Functions, I noticed that there is no documentation yet and very few examples, so here’s my first simple example on how to build an Azure Function using PHP to parse a very simple GET request.

I’m assuming you’ve set up your function, go into Files and edit the function.json file:

 

<br />
{<br />
  &quot;bindings&quot;: [<br />
    {<br />
      &quot;type&quot;: &quot;httpTrigger&quot;,<br />
      &quot;direction&quot;: &quot;in&quot;,<br />
      &quot;name&quot;: &quot;req&quot;,<br />
      &quot;methods&quot;: [<br />
        &quot;get&quot;<br />
      ],<br />
      &quot;authLevel&quot;: &quot;function&quot;<br />
    },<br />
    {<br />
      &quot;type&quot;: &quot;http&quot;,<br />
      &quot;direction&quot;: &quot;out&quot;,<br />
      &quot;name&quot;: &quot;res&quot;<br />
    }<br />
  ],<br />
  &quot;disabled&quot;: false<br />
}<br />

This sets the function to listen to get requests and ignore the default Azure Table storage stuff.

Then open the run.php file and Continue reading Parsing a GET request in PHP with an Azure Function