added another example
This commit is contained in:
parent
feccae9255
commit
1559b55ca0
24
index.php
24
index.php
@ -125,7 +125,9 @@ define('CONN', (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "")?'http':'ht
|
||||
</div>
|
||||
<div class="6u">
|
||||
<section>
|
||||
<h2>Example PHP script</h2>
|
||||
<h1>Examples</h1>
|
||||
|
||||
<h3>Simple link via img tag</h3>
|
||||
<p class="margin-bottom"></p>
|
||||
<p>
|
||||
<pre><code class="php">
|
||||
@ -138,6 +140,26 @@ define('CONN', (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "")?'http':'ht
|
||||
?>
|
||||
</code></pre>
|
||||
</p>
|
||||
|
||||
|
||||
<h3>Proxy script to download the image via curl</h3>
|
||||
<p class="margin-bottom"></p>
|
||||
<p>
|
||||
<pre><code class="php">
|
||||
<?php
|
||||
$targeturl = 'http://www.xkcd.com';
|
||||
$url = '<?php echo CONN; ?>://<?php echo DOMAIN; ?>/api.php?url='.rawurlencode($targeturl);
|
||||
|
||||
$ch = curl_init($url);
|
||||
$fp = fopen('xkcd.jpg', 'wb');
|
||||
curl_setopt($ch, CURLOPT_FILE, $fp);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
fclose($fp);
|
||||
?>
|
||||
</code></pre>
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user