Jump to content

Creating a Twitter share button...


mattvit

Recommended Posts

Hey everyone, thank you for taking the time to read this.

 

So I'm re-inventing the wheel..! Sort of. I thought it'd be a quick job to do, but it appears not to be.

 

Basically, I just want to have a hash tag # in a variable. Is this possible?

 

Ie,

$twitter_msg = "I just was reading mattvits website, website.com #coolwebsites #awesomewebmasters"

 

Is it possible to pass the hash symbol in a PHP variable? If so, how? I tried \#, didn't work.

 

Again, thanks in advance!! :)

Link to comment
Share on other sites

It worked! But sadly the little hash/pound symbol didn't make it through the URL into Twitter.

 

$tweetmsg = "content here ".$tweeturl." &#35firsttag &#35secondtag";

 

Any ideas? Would using a HTML entity for the spacing help? ... maybe I should try that...

 

update: The entity spacing didn't work. I'm stumped. Is there some way for the URL to decode the HTML entity, rather than the web server??

Link to comment
Share on other sites

Ah ha! Found a question on stackoverflow which suggested the following. For SEO purposes (as there aren't many relevant results in Google) I'm making another post rather than editing. Here you go, world:

 

$tweeturl = 'www.phpfreaks.com';

$tweetmsg = rawurlencode('CONTENT HERE'.$tweeturl.' #HASHTAG');

 

Thanks for your help anyway, MasterAce14!

 

p.s. I don't know if it's just for newbies but this is one of the most spam-strict forums I've ever come across. The verification questions are extremely frustrating. I'm only 21 and couldn't care less about the Beatles (sorry!) so I had difficulty signing up initially... Pretty frustrating stuff. Won't be coming back here. (though I'm sure the members here are great :) )

Link to comment
Share on other sites

p.s. I don't know if it's just for newbies but this is one of the most spam-strict forums I've ever come across. The verification questions are extremely frustrating. I'm only 21 and couldn't care less about the Beatles (sorry!) so I had difficulty signing up initially... Pretty frustrating stuff. Won't be coming back here. (though I'm sure the members here are great  )

 

We are also the largest php community getting around and get ALLOT of spam on a daily basis. It's just the price you pay.

Link to comment
Share on other sites

Sorry I can't let this slip.

 

OP, are you serious? Your "fraustrated" because PHPfreaks likes to keep a solid user base and prevent spam? Any other board not taking the same security measures must really suck to be around because we rarely see any spamming going around here.

 

edit: In all 4 (almost 5) years of being on this site, I have seen 1 spam post.

 

We are the largest forum for a reason, because we are damn awsome.

Link to comment
Share on other sites

 

Sorry I can't let this slip.

 

 

OP, are you serious? Your "fraustrated" because PHPfreaks likes to keep a solid user base and prevent spam? Any other board not taking the same security measures must really suck to be around because we rarely see any spamming going around here.

 

 

edit: In all 4 (almost 5) years of being on this site, I have seen 1 spam post.

 

 

We are the largest forum for a reason, because we are damn awsome.

agreed. this is the only forum that i go to for PROGRAMMING. I've gotten help from awesome people and also, I've helped people. :hail_freaks:

Link to comment
Share on other sites

Hey all, I take back my comments and apologise. I was doing a 24-hour all-nighter programming session and was starting to get the '-I'm-Tired-So-I'm-Angry-At-Anything' that I hope others get too..!! (edit: I hope others get it too because otherwise I just look like an angry internet troll! I'm not.. :) )

 

Your comment re: 5 years and 1 spam post really impressed me. I guess I just wasn't used to this system.

 

Does the verification go away eventually?? ie once someone is an established member with x posts or x time here?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.