PHP examples

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.


  • 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:

        $request = new HttpRequest();
          'postman-token' => 'a6ea9e58-c0e0-0f4e-f397-ddba4c69ee80',
          'cache-control' => 'no-cache',
          'app_id' => 'XXXXXXXX'
        try {
          $response = $request->send();
          echo $response->getBody();
        } catch (HttpException $ex) {
          echo $ex;
  • xeniumxenium Member

    HI there, please provide an example in CURL, the follwin g is not workign

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'app_id: xxxx',
    'app_key: xxxx'

  • SimoneSimone Administrator admin

    Hi @xenium
    Have you tried the tool my former colleague mentioned above, Postman?
    I understand it is a free code-snippet generator, so you might be able to get the example you need.

  • xeniumxenium Member

    hi Simone, thanks for your reply. I have briefly tried Postman but not had much luck yet, I was hoping to avoid having to learn how to use it just to get a few lines of code, but if I can find the time I will do a tutorial on it and then hopefully extract some working code.

    Meanwhile if anyone has an example PHP script for a call to Oxford Dictionaries API that would be amazing!

    Thanks again

  • xeniumxenium Member

    Ok a bit of googling + Postman later here is some PHP, seems to work fine:

    $app_key = 'yourappkey';
    $app_id = 'yourappid';

    $auth = array("app_key: $app_key", "app_id: $app_id");

    $url = "";
    $endpoint = "entries";
    $language_code = "en-us";
    $lookup_word = "simple";

    $curl = curl_init();

    curl_setopt_array($curl, array(
    CURLOPT_URL => "$url/$endpoint/$language_code/$lookup_word",

    $response = curl_exec($curl);

    echo $response;

  • SimoneSimone Administrator admin

    Hi @xenium
    I'm glad it worked in the end - and many thanks for sharing the code!

  • essensianessensian Member

    Thank you Xenium, it worked for me and saved me a lot of time.

Sign In or Register to comment.