Browse files

Merge branch 'refs/heads/master' into gh-pages

  • Loading branch information...
2 parents 376790c + 4fc42ce commit 09da1b9cfcaad70b6e5975126cec1f3ee6a2ae6e @bramus committed Mar 19, 2012
Showing with 35 additions and 3 deletions.
  1. +35 −3 07.restful.apis.html
  2. BIN assets/07/moviesdb.png
View
38 07.restful.apis.html
@@ -521,6 +521,12 @@ <h3 class="inverted">Rich Internet Applications</h3>
</li>
</ul>
</section>
+
+ <section>
+ <h2>Case Study: MoviesDB</h2>
+ <p style="text-align: center;" class="fragment"><a href="http://bramus.github.com/simple-rest-api-explorer/"><img src="assets/07/moviesdb.png" width="600" height="487" alt="" title="" style="background: transparent; border: 0; -webkit-box-shadow: none; -moz-box-shadow: none; -ms-box-shadow: none; -o-box-shadow: none; box-shadow: none;" /></a><p>
+ <footer class="fragment">(click image to launch)</footer>
+ </section>
<section>
<h2>URL Design Sidenotes</h2>
@@ -876,11 +882,13 @@ <h3 class="inverted">Rich Internet Applications</h3>
// jsonp
if (PlonkFilter::getGetValue('callback')) {
+ header('Content-type: application/javascript');
echo PlonkFilter::getGetValue('callback') . '(' . $json . ');';
}
// json
else {
+ header('Content-type: application/json');
echo $json;
}
}</code></pre>
@@ -1108,7 +1116,7 @@ <h3 class="inverted">Rich Internet Applications</h3>
</section>
<section>
- <h2>1. API Consumers</h2>
+ <h2>1. API Consumers (1)</h2>
<ul>
<li class="fragment">
Make use of API-Keys
@@ -1132,10 +1140,34 @@ <h3 class="inverted">Rich Internet Applications</h3>
$this-&gt;display();
exit();
}
-}
-</code></pre>
+}</code></pre>
+ </div>
+ </li>
+ </ul>
+ </section>
+
+ <section>
+ <h2>1. API Consumers (2)</h2>
+ <ul>
+ <li class="fragment">
+ Note: <code>apache_request_headers()</code> not always available!
+ <div class="fragment">
+ <pre class="bigger language-php"><code>if (!function_exists('apache_request_headers')) {
+ eval('
+ function apache_request_headers() {
+ foreach($_SERVER as $key=>$value) {
+ if (substr($key,0,5)==&quot;HTTP_&quot;) {
+ $key=str_replace(&quot; &quot;,&quot;-&quot;,ucwords(strtolower(str_replace(&quot;_&quot;,&quot; &quot;,substr($key,5)))));
+ $out[$key]=$value;
+ }
+ }
+ return $out;
+ }
+ ');
+}</code></pre>
</div>
</li>
+ <li class="fragment">Also: won't work on IIS</li>
</ul>
</section>
View
BIN assets/07/moviesdb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 09da1b9

Please sign in to comment.