Permalink
Browse files

Added PHP template

  • Loading branch information...
1 parent 7d59389 commit 3578c085a4f7b086e5ae3e80294f46cb0938e9fd David Barton committed Aug 20, 2012
Showing with 22 additions and 0 deletions.
  1. +22 −0 php.html
View
@@ -0,0 +1,22 @@
+<section name="php" class="php">
+ <p class="ioDesc">In</p>
+ <pre class="incoming brush:php">
+
+<% headerFirst = true %>
+
+<%= "<?php" %>
+
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, "<%= @apiUrl %><%= @url %>");
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+<% if @method is 'POST': %>curl_setopt($ch, CURLOPT_POST, TRUE);
+<% end %><% if @method isnt 'GET' and @method isnt 'POST': %>curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "<%= @method %>");
+<% end %><% if @body and @body.length > 0: %>curl_setopt($ch, CURLOPT_POSTFIELDS, <%= @helpers.escape @body.join('') %>);
+<% end %><% if @headers and @helpers.isNotEmpty(@headers): %>curl_setopt($ch, CURLOPT_HTTPHEADER, array(<% for header, value of @headers: %><% if headerFirst: %><% headerFirst = false %><% else: %>, <% end %><%= @helpers.escape "#{header}: #{value}" %><% end %>));
+<% end %>$response = curl_exec($ch);
+curl_close($ch);
+
+echo $response;
+
+ </pre>
+</section>

0 comments on commit 3578c08

Please sign in to comment.