Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

Get response headers from POST request with curl

curl -s -d 'test=test' -D- www.google.com -o/dev/null
https://snipt.net/embed/ff9964a6872571066ed5cc4c13f1674a/
https://snipt.net/raw/ff9964a6872571066ed5cc4c13f1674a/
ff9964a6872571066ed5cc4c13f1674a
bash
Bash
1
2016-12-08T05:13:18
True
False
False
Jan 17, 2013 at 10:26 AM
/api/public/snipt/53893/
get-response-headers-from-post-request-with-curl
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>curl -s -d <span class="s1">&#39;test=test&#39;</span> -D- www.google.com -o/dev/null </span></pre></div> </td></tr></table>
bash, curl, headers, post

PHP

Prompt user to 'open' or 'save' file when delivering dynamic file data with PHP

1
2
3
4
5
6
7
<?
header("content-type: $mime_type");
header("content-disposition: attachment; filename=$file_name");
header("cache-control: private");
header("pragma: private");
echo $file_data;
?>
https://snipt.net/embed/e107659ef24a3df68f6f7f9e131ae206/
https://snipt.net/raw/e107659ef24a3df68f6f7f9e131ae206/
e107659ef24a3df68f6f7f9e131ae206
php
PHP
7
2016-12-08T00:30:05
True
False
False
/api/public/snipt/14226/
prompt-user-to-open-or-save-when-delivering-file-data-stored-in-database-with-php
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">header</span><span class="p">(</span><span class="s2">&quot;content-type: </span><span class="si">$mime_type</span><span class="s2">&quot;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="nb">header</span><span class="p">(</span><span class="s2">&quot;content-disposition: attachment; filename=</span><span class="si">$file_name</span><span class="s2">&quot;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="nb">header</span><span class="p">(</span><span class="s2">&quot;cache-control: private&quot;</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="nb">header</span><span class="p">(</span><span class="s2">&quot;pragma: private&quot;</span><span class="p">);</span> </span><span id="L-6"><a name="L-6"></a><span class="k">echo</span> <span class="nv">$file_data</span><span class="p">;</span> </span><span id="L-7"><a name="L-7"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
download, file, headers, http, php
Copyrighted, illegal, or inappropriate content? Email [email protected].