PHP examples

Hi.
Can you include PHP examples as you do with Objective-C ?
Taking in count that PHP is the most used web language, it makes sence to have it.
Thanks

Comments

  • AmosDuveenAmosDuveen Member, Administrator, Moderator admin

    Hi @fkrum56,

    We'll certainly pass your feedback on. Meanwhile, you can always find commercial and even open source software that generates snippets of code for specific tasks in all sorts of languages. For example, I have a tool called Postman which I use to make API calls so that I can reproduce issues people are asking about on this forum; that same tool can also produce snippets of example code for the call in question. Here is the example code for an entry call (ace) using the PHP HttpRequest option:

        <?php
    
        $request = new HttpRequest();
        $request->setUrl('https://od-api.oxforddictionaries.com:443/api/v1/entries/en/ace');
        $request->setMethod(HTTP_METH_GET);
    
        $request->setHeaders(array(
          'postman-token' => 'a6ea9e58-c0e0-0f4e-f397-ddba4c69ee80',
          'cache-control' => 'no-cache',
          'app_key' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
          'app_id' => 'XXXXXXXX'
        ));
    
        try {
          $response = $request->send();
    
          echo $response->getBody();
        } catch (HttpException $ex) {
          echo $ex;
        }
    
Sign In or Register to comment.