Jump to content

Need help with SMF bbcode mod


S3NTYN3L

Recommended Posts

I need my LMGTFY mod to not only point to lmgtfy, but to create and get its resultant url from tinyurl.

 

I've found this floating around the net:

 

<?php
$url = "http://vijayjoshi.org";
$tiny = file_get_contents("http://tinyurl.com/api-create.php?url=$url");
echo 'Original url : '.$url;
echo '[br /]';
echo '[br /]';
echo 'TinyURL (Click to test) : <a href="'.$tiny.'" target="_blank">'.$tiny.'[/url]';
?>

 

 

 

Which I've narrowed down to:

$lmgtfyurl = "http://lmgtfy.com/?q=$1";
$tiny = file_get_contents("http://tinyurl.com/api-create.php?url=$lmgtfyurl");

 

 

And I think I can use it in the lmgtfy bbc like this, somehow:

 

'content' => '<a href="'.$tiny.'" class="bbc_link new_win" target="_blank">$1[/url]',

 

 

Now, this doesn't break the forum, but it also doesn't work.

It doesn't work because I've no idea how to make the function needed...

 

I don't have all that much experience with PHP.

My mod is really just an edit of the default url bbc found in SMF...

 

My smf mod can be found here: http://custom.simplemachines.org/mods/index.php?mod=2814

 

 

 

Any help is greatly appreciated!

Link to comment
https://forums.phpfreaks.com/topic/220702-need-help-with-smf-bbcode-mod/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.