Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 290d82fcbe
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (19 sloc) 0.983 kb
<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);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
<% 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>
Jump to Line
Something went wrong with that request. Please try again.