%p Use the following code snippet to get data from the API.

- block = capture do
  :coderay
    #!php
    <?php
    $morph_api_url = "[scraper_url]/data.json";
    $morph_api_key="[api_key]";

    $query="[query]";

    $response=file_get_contents($morph_api_url.'?key='.$morph_api_key.'&query='.urlencode($query));
    $js=json_decode($response,true);

    foreach ($js as $line){
      [DO WIZARDRY]
    }
    ?>

= block.sub('[scraper_url]', "#{api_root}<span class='full_name'>#{h(@scraper.full_name)}</span>").sub('[api_key]', "<span class='unescaped-api_key'>#{current_user ? current_user.api_key : '[api_key]'}</span>").sub('[query]', "<span class='unescaped-query'>#{h(@query)}</span>").html_safe

%p Use the following code snippet to get data from the API.

- block = capture do
  :coderay
    #!php
    <?php
    $morph_api_url = "[scraper_url]/data.json";
    $morph_api_key="[api_key]";

    $query="[query]";

    $response=file_get_contents($morph_api_url.'?key='.$morph_api_key.'&query='.urlencode($query));
    $js=json_decode($response,true);

    print_r($js);
    ?>

= block.sub('[scraper_url]', "#{api_root}<span class='full_name'>#{h(@scraper.full_name)}</span>").sub('[api_key]', "<span class='unescaped-api_key'>#{current_user ? current_user.api_key : '[api_key]'}</span>").sub('[query]', "<span class='unescaped-query'>#{h(@query)}</span>").html_safe

Make entire php example runnable as is
Make entire php example runnable as is
