login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Handige scripts > Pastebin script

Pastebin script

Auteur: Stijn - 10 maart 2010 - 00:00 - Gekeurd door: Stijn - Hits: 3628 - Aantal punten: 5.00 (2 stemmen)




Deze klasse plaatst code op pastebin.com.
Wanneer de code geplaatst is met de post() methode,
kan je de geplaatste code op verschillende manieren gaan gebruiken.

Je kan de direct URL naar de pastebin.com pagina opvragen met getDirectURL().
Je kan de javascript embedded URL opvragen met getEmbeddedJsURL().
Deze URL moet je tussen <script src="..."></script> code plaatsen.
Of je vraagt de iframe embedded URL op met getEmbeddedIframeURL().
Deze URL moet je tussen <iframe src="..." style="border:none;width:100%;"></iframe> code plaatsen.

Deze code maakt gebruik van de PHP CURL functies. Dus zorg dat de CURL module actief is.

Voor meer informatie over de pastebin.com API: http://pastebin.com/api.php.

Code:
Pastebin.php
http://aiids.pastebin.com/10UmGg9A

Voorbeeld
  1. <?php
  2. include_once 'Pastebin.php';
  3.  
  4. $pastebin = new Com_Wordpress_Aiids_Util_Pastebin(
  5. file_get_contents('Pastebin.php'), //paste_code
  6. 'php', //paste_format
  7. 'Stijn', //paste_name
  8. 'stijnleenknegt@gmail.com', //paste_email
  9. 'aiids', //paste_subdomain
  10. Com_Wordpress_Aiids_Util_Pastebin::PBLC, //paste_private
  11. Com_Wordpress_Aiids_Util_Pastebin::NEVER); //paste_expire_date
  12. $pastebin->post();
  13. echo '<script src="' . $pastebin->getEmbeddedJsURL() . '"></script>';
  14. ?>
Download code! Download code (.txt)

Download dit script!
 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (2)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.022s