Thread: New Posting Features - WS vBulletin Tweet Poster
View Single Post
  #372  
Old 01-31-2011, 02:10 PM
tokenyank tokenyank is offline
 
Join Date: Jul 2005
Location: London
Posts: 142
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Mosh - Quick question in hopes this is in scope of your support!

I've just installed YOURLS on a 4 letter domain I managed to get to create my own shortening service as shortening services die, I'd rather run my own to ensure that links in the wild are maintained rather than 404'd.

YOURLS doesn't require auth and allows a get/post api call to access the service:
Quote:
Secure passwordless API call

YOURLS allows API calls the old fashioned way, using username and password parameters. If you're worried about sending your credentials into the wild, you can also make API calls without using your login or your password, using a secret signature token.

Your secret signature token: <SECRET API EDITED OUT> (It's a secret. Keep it secret)

This signature token can only be used with the API, not with the admin interface.

*
Usage of the signature token

Simply use parameter signature in your API requests. Example:

http://mums.ws/yourls-api.php?signature=<SECRET API EDITED OUT>&action=...
I've just tried to add the service into your mod and not working - I'm hoping you might be able to shed a bit of light on the subject?

What I've done is changed all instances of the cURL from:
Code:
elseif ($vbulletin->options['ms_vbtwitter_use_url_shortening'] == 3)
			{
				$tinyurl = curl_init();
				curl_setopt($tinyurl, CURLOPT_URL, 'http://tinyurl.com/api-create.php?url=' .  $baseURL);
				curl_setopt($tinyurl, CURLOPT_RETURNTRANSFER, 1);
				$shortURL = curl_exec($tinyurl); 
				curl_close($tinyurl);
			}
			else
			{
				$metamark = curl_init();
				curl_setopt($metamark, CURLOPT_URL, 'http://metamark.net/api/rest/simple?long_url=' .  $baseURL);
				curl_setopt($metamark, CURLOPT_RETURNTRANSFER, 1);
				$shortURL = curl_exec($metamark); 
				curl_close($metamark);
			}
to:
Code:
elseif ($vbulletin->options['ms_vbtwitter_use_url_shortening'] == 4)
			{
				$metamark = curl_init();
				curl_setopt($metamark, CURLOPT_URL, 'http://metamark.net/api/rest/simple?long_url=' .  $baseURL);
				curl_setopt($metamark, CURLOPT_RETURNTRANSFER, 1);
				$shortURL = curl_exec($metamark); 
				curl_close($metamark);
			}
			else
			{
				$mums = curl_init();
				curl_setopt($mums, CURLOPT_URL, 'http://mums.ws/yourls-api.php?signature=<SECRET API EDITED OUT>&action=' .  $baseURL);
				curl_setopt($mums, CURLOPT_RETURNTRANSFER, 1);
				$shortURL = curl_exec($mums); 
				curl_close($mums);
			}
And the piped from:
Code:
<optioncode>select:piped
0|No url shortening
1|bit.ly url shortening
2|is.gd url shortening
3|TinyURL url shortening
4|Metamark url shortening</optioncode>
to:
Code:
<optioncode>select:piped
0|No url shortening
1|bit.ly url shortening
2|is.gd url shortening
3|TinyURL url shortening
4|Metamark url shortening
5|mums url shortening</optioncode>
XML imports without problem, settings store with no problem, and NEWTHREAD creation without problem - however it doesn't Tweet the new thread to Twitter.

I'm not a php guru, but from going through your mod, it seemed to me that is was all I needed to change however since it is failing, I guess I was wrong...

Could you perhaps either help me get this working or add a provision in the next update to allow installations of YOURLS to be handled for those of us who want to use our own shorteners?

Thanks Mosh, I apprecaite your help in advance!
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01215 seconds
  • Memory Usage 1,785KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete