title: Got error when trying to push via AWS SNS "Wrong number of slashes in relative portion of the ARN."
body: <p>I try to adapt the source from <a href="https://stackoverflow.com/questions/21557179/sending-amazon-sns-from-my-php-server">Here</a> but it return error "Wrong number of slashes in relative portion of the ARN." I google it but can't find any related to this error. what should I do to make a publish.</p>
  
  <pre><code>    &lt;?php
  
  require '&lt;path to this file&gt;/aws.phar';
  use Aws\Sns\SnsClient;
  
  if(isset($_POST['submit']))
  {
      $push_message = $_POST['push_message'];
  
      if(!empty($push_message))
      {
          // Create a new Amazon SNS client
          $sns = SnsClient::factory(array(
              'key'    =&gt; '&lt;access key&gt;',
              'secret' =&gt; '&lt;app secret&gt;',
              'region' =&gt; '&lt;region code&gt;'
              ));
  
          // region code samples: us-east-1, ap-northeast-1, sa-east-1, ap-southeast-1, ap-southeast-2, us-west-2, us-gov-west-1, us-west-1, cn-north-1, eu-west-1
  
          $iOS_AppArn = "&lt;iOS app's Application ARN&gt;";
          $android_AppArn = "&lt;android app's Application ARN&gt;";
  
          // Get the application's endpoints
          $iOS_model = $sns-&gt;listEndpointsByPlatformApplication(array('PlatformApplicationArn' =&gt; $iOS_AppArn));
          $android_model = $sns-&gt;listEndpointsByPlatformApplication(array('PlatformApplicationArn' =&gt; $android_AppArn));
  
          // Display all of the endpoints for the iOS application
          foreach ($iOS_model['Endpoints'] as $endpoint)
          {
              $endpointArn = $endpoint['EndpointArn'];
              echo $endpointArn;
          }
  
          // Display all of the endpoints for the android application
          foreach ($iOS_model['Endpoints'] as $endpoint)
          {
              $endpointArn = $endpoint['EndpointArn'];
              echo $endpointArn;
          }
  
          // iOS: Send a message to each endpoint
          foreach ($iOS_model['Endpoints'] as $endpoint)
          {
              $endpointArn = $endpoint['EndpointArn'];
  
              try
              {
                  $sns-&gt;publish(array('Message' =&gt; $push_message,
                      'TargetArn' =&gt; $endpointArn));
  
                  echo "&lt;strong&gt;Success:&lt;/strong&gt; ".$endpointArn."&lt;br/&gt;";
              }
              catch (Exception $e)
              {
                  echo "&lt;strong&gt;Failed:&lt;/strong&gt; ".$endpointArn."&lt;br/&gt;&lt;strong&gt;Error:&lt;/strong&gt; ".$e-&gt;getMessage()."&lt;br/&gt;";
              }
          }
  
          // android: Send a message to each endpoint
          foreach ($android_model['Endpoints'] as $endpoint)
          {
              $endpointArn = $endpoint['EndpointArn'];
  
              try
              {
                  $sns-&gt;publish(array('Message' =&gt; $push_message,
                      'TargetArn' =&gt; $endpointArn));
  
                  echo "&lt;strong&gt;Success:&lt;/strong&gt; ".$endpointArn."&lt;br/&gt;";
              }
              catch (Exception $e)
              {
                  echo "&lt;strong&gt;Failed:&lt;/strong&gt; ".$endpointArn."&lt;br/&gt;&lt;strong&gt;Error:&lt;/strong&gt; ".$e-&gt;getMessage()."&lt;br/&gt;";
              }
          }
      }
  }   
  ?&gt;
  </code></pre>