TweetWX forecast error

Hello all,

I’m trying to get Ken True’s TweetWX, TweetWX-forecast.php script to execute properly, however I receive a “code”: 186, “message”: “Status is over 140 characters.” error. In another post on this Board from 2012, Ken addressed a similar problem but I have been unsuccessful in resolving the problem.

The problem area:

$message = trim($message);
if (strlen($message) > 140) {
	echo $message . ' too long ('.strlen($message). ") -- reducing size
\n";
	$message = preg_replace('|This Afternoon|i','Aft.noon',$message);
	$message = preg_replace('|night|is',' nite',$message);
	$message = preg_replace('|Tonight|is',' nite',$message);
	$message = preg_replace('|Likely|is',' Lkly',$message);
	$message = preg_replace('|Chance|is','Chc',$message);
	$message = preg_replace('|chance|is','Chc',$message);
	$message = preg_replace('|Partly|is','Ptly',$message);
	$message = preg_replace('|showers|is','Shwrs',$message);
	$message = preg_replace('|Mostly|is','Mstly',$message);
	$message = preg_replace('|Scattered|is','Sctd',$message);
	$message = preg_replace('|increasing|is','Incr.',$message);
	foreach ($DOWeek as $name => $abbrev) {
		$message = preg_replace("|$name|s",$abbrev,$message);

The output:

NWS fcst: ThisAfternoonChance Snow: , Hi 36�F; TonightSnow: , Lo 28�F⇑; SaturdaySnow Likelythen ChanceSnow: , Hi 35�F⇓; http://tinyurl.com/hhyu8dy #weather too long (166) -- reducing size
NWS fcst: ThisAfternoonChc Snow: , Hi 36�F; To niteSnow: , Lo 28�F⇑; SatSnow Lklythen ChcSnow: , Hi 35�F⇓; http://tinyurl.com/hhyu8dy #weather
len=154
status={ "errors": [ { "code": 186, "message": "Status is over 140 characters." } ] }

I would sure appreciate any suggestions to help me resolve this problem.

Regards,

EDIT

[color=blue]Further research revealed the solution to my problem by Ken on a response to a user having similar issues on the WXForum.
I don’t know the rules and protocol in regards to posting offsite links, so I’ll err on the side of caution. If someone would like to know the link to Ken’s response and accompanying updated file, contact me.

Thanks for reading and much thanks to all the programmers for the scripts and all the fellow PWS enthusiasts sharing your knowledge and help!

Best Regards[/color]

Answered on WXForum.net where the updated code resides.

Ken