Advertisement
MLF

PHP cURL DEMO

MLF
Jul 30th, 2011
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/D​    TD/xhtml11.dtd">
  2. <html>
  3. <head>
  4. <title>cURL DEMO</title>
  5. <style type="text/css" media="all">
  6. @import url("http://static.php.net/www.php.​net/styles/site.css");
  7. @import url("http://static.php.net/www.php.​net/styles/phpnet.css");
  8. </style>
  9. <!--[if IE]><![if gte IE 6]><![endif]-->
  10. <style type="text/css" media="print">
  11. @import url("http://static.php.net/www.php.​net/styles/print.css");
  12. </style>
  13. <style type="text/css">
  14. .phpquote {
  15. border: solid;
  16. height: 300px;
  17. left: 50px;
  18. overflow-y: scroll;
  19. padding: 5px;
  20. position: absolute;
  21. right: 50px;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <a href="?function=echo">echo</a>​<br/>
  27. <a href="?function=md5">md5</a><b​r/>
  28. <a href="?function=nl2br">nl2br</​a><br/>
  29. <hr/>
  30. <?php
  31. if(isset($_GET['function']) && $_GET['function'] != '')
  32. {
  33. $url = 'http://www.php.net/manual/en/f​unction.'.$_GET['function'].'.php';
  34. $curl_handler = curl_init($url);
  35. curl_setopt($curl_handler, CURLOPT_HEADER, false);
  36. ob_start();
  37. curl_exec($curl_handler);
  38. $result = ob_get_contents();
  39. ob_end_clean();
  40. curl_close($curl_handler);
  41. echo 'Manual (from <a href="http://www.php.net/" target="_blank">PHP Web Site</a>) :<br/>'."\n";
  42. echo '<hr/>'."\n";
  43. echo '<div class="phpquote">'."\n";
  44. $result = substr($result, strpos($result, '<div id="function.'.$_GET['function​'].'" class="refentry">'));
  45. $result = substr($result, 0, strpos($result, '<div class="foot">'));
  46. $result = substr($result, 0, strpos($result, '<!--UdmComment-->')).substr($​result, strpos($result, '<!--/UdmComment-->'));
  47. $result = trim($result);
  48. echo $result."\n";
  49. echo '</div>'."\n";
  50. }
  51. ?>
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement