public function publish($topicArn, $message, $subject = '', $messageStructure = '') {
		if(empty($topicArn) || empty($message)) {
			throw new InvalidArgumentException('Must supply a TopicARN and Message to publish to a topic');
		}

		$params = array(
			'TopicArn' => $topicArn,
			'Message' => $message
		);

		if(!empty($subject)) {
			$params['Subject'] = $subject;
		}

		if(!empty($messageStructure)) {
			$params['MessageStructure'] = $messageStructure;
		}

		$resultXml = $this->_request('Publish', $params);

		return strval($resultXml->PublishResult->MessageId);
	}
public function publish($topicArn, $message, $subject = '', $messageStructure = '') {
		if(empty($topicArn) || empty($message)) {
			throw new InvalidArgumentException('Must supply a TopicARN and Message to publish to a topic');
		}

		$params = array(
			'TopicArn' => $topicArn,
			'Message' => $message
		);

		if(!empty($subject)) {
			$params['Subject'] = $subject;
		}

		if(!empty($messageStructure)) {
			$params['MessageStructure'] = $messageStructure;
		}

		$resultXml = $this->_request('Publish', $params);

		return strval($resultXml->PublishResult->MessageId);
	}
public function publish ( $ topicArn , $ message , $ subject = '' , $ messageStructure = '' ) { if ( empty ( $ topicArn ) || empty ( $ message ) ) { throw new InvalidArgumentException ( 'Must supply a TopicARN and Message to publish to a topic' ) ; } $ params = array ( 'TopicArn' => $ topicArn , 'Message' => $ message ) ; if ( ! empty ( $ subject ) ) { $ params [ 'Subject' ] = $ subject ; } if ( ! empty ( $ messageStructure ) ) { $ params [ 'MessageStructure' ] = $ messageStructure ; } $ resultXml = $ this -> _request ( 'Publish' , $ params ) ; return strval ( $ resultXml -> PublishResult -> MessageId ) ; }
Publish a message to a topic

@link http://docs.amazonwebservices.com/sns/latest/api/API_Publish.html
@param string $topicArn
@param string $message
@param string $subject [optional] Used when sending emails
@param string $messageStructure [optional] Used when you want to send a different message for each protocol.If you set MessageStructure to json, the value of the Message parameter must: be a syntactically valid JSON object; and contain at least a top-level JSON key of "default" with a value that is a string.
@return string
@throws InvalidArgumentException
Publish a message to a topic