title: Paypal php Rest API, "Got Http response code 404" error on redirect
body: <p>I'm using Laravel, here the code:</p>
  
  <p>Create payment method</p>
  
  <pre><code>public function create() {
      $payer = Paypalpayment::Payer();
      $payer-&gt;setPayment_method("paypal");
  
      $amount = Paypalpayment:: Amount();
      $amount-&gt;setCurrency("USD");
      $amount-&gt;setTotal("1.00");
  
      $transaction = Paypalpayment:: Transaction();
      $transaction-&gt;setAmount($amount);
      $transaction-&gt;setDescription("This is the payment description.");
  
      $redirectUrls = Paypalpayment::RedirectUrls();
      $redirectUrls-&gt;setReturnUrl("http://mysite/prova/public/payment/execute")
              -&gt;setCancelUrl("http://mysite/prova/public/payment/problema");
  
      $payment = Paypalpayment:: Payment();
      $payment-&gt;setIntent("sale");
      $payment-&gt;setPayer($payer); 
      $payment-&gt;setRedirectUrls($redirectUrls);
      $payment-&gt;setTransactions(array($transaction));
  
      try {
          $payment-&gt;create($this-&gt;_apiContext);
      } catch (PayPal\Exception\PPConnectionException $ex) {
          echo "Exception: " . $ex-&gt;getMessage() . PHP_EOL;
          echo "&lt;pre&gt;";
          var_dump($ex-&gt;getData());   
          echo "&lt;/pre&gt;";
          exit(1);
      }
  
  
      foreach($payment-&gt;getLinks() as $link) {
          if($link-&gt;getRel() == 'approval_url') {
              $redirectUrl = $link-&gt;getHref();
              break;
          }
      }
  
      $_SESSION['paymentId'] = $payment-&gt;getId();
      if(isset($redirectUrl)) {
          header("Location: $redirectUrl");
          exit;
      }
  }
  
  public function execute() {
      $input = Input::all();
  
      echo "&lt;pre&gt;";
      print_r($input);
      echo "&lt;/pre&gt;";
  }
  </code></pre>
  
  <p>Whe I return to $redirectUrl after payment approval, this is the error:</p>
  
  <p>Got Http response code 404 when accessing <a href="https://api.sandbox.paypal.com/v1/payments/payment/execute" rel="nofollow">https://api.sandbox.paypal.com/v1/payments/payment/execute</a>. Retried 0 times.</p>
  
  <p>The Routes are correct and indeed in the url bar of the browser there' the correct url but I've this error. The courius thing is that if i specify as redirectUrl something like <a href="http://www.google.com" rel="nofollow">http://www.google.com</a> everythings work...</p>
  
  <p>Here the log:</p>
  
  <pre><code>PayPal\Core\PPHttpConnection: Connecting to https://api.sandbox.paypal.com/v1/oauth2/token
  PayPal\Core\PPHttpConnection: Payload grant_type=client_credentials
  PayPal\Core\PPHttpConnection: Adding header User-Agent: PayPalSDK/rest-sdk-php 0.6.0 (lang=PHP;v=5.3.3;bit=64;os=Linux_2.6.32-358.2.1.el6.x86_64;machine=x86_64;openssl=1.0.1e-fips;curl=7.19.7)
  PayPal\Core\PPHttpConnection: Adding header Authorization: Basic QWRvemloQmxyYkNaNFNTOFNnQXczZjBlSHdKaXhSX0p4NkFWTVFVeUdGTUFQX0NnY2JRYm5UWXBDQmY4OkVIdmlkUkM3c2lkYXVaZjA3MnBITXp1Z1J3VHlXaGV3bUtKSFhMaFkzM0ZUWDF4WWc0UWpQbGZoR1hDVw==
  PayPal\Core\PPHttpConnection: Adding header Accept: */*
  PayPal\Core\PPHttpConnection: Connecting to https://api.sandbox.paypal.com/v1/payments/payment
  PayPal\Core\PPHttpConnection: Payload {"intent":"sale","payer":{"payment_method":"paypal"},"redirect_urls":{"return_url":"http:\/\/mysite\/prova\/public\/payment\/execute","cancel_url":"http:\/\/mysite\/prova\/public\/payment\/problema"},"transactions":[{"amount":{"currency":"USD","total":"1.00"},"description":"This is the payment description."}]}
  PayPal\Core\PPHttpConnection: Adding header Content-Type: application/json
  PayPal\Core\PPHttpConnection: Adding header User-Agent: PayPalSDK/rest-sdk-php 0.6.0 (lang=PHP;v=5.3.3;bit=64;os=Linux_2.6.32-358.2.1.el6.x86_64;machine=x86_64;openssl=1.0.1e-fips;curl=7.19.7)
  PayPal\Core\PPHttpConnection: Adding header Authorization: Bearer A015CdyoK5GgT4ROb9n-iNBLY1OjO4tJvJeV-eOMdDVyKbc
  PayPal\Core\PPHttpConnection: Adding header PayPal-Request-Id: 160110728012881140025562311630
  PayPal\Transport\PPRestCall: {"id":"PAY-969088725C646431RKN3DJAY","create_time":"2014-05-16T15:53:39Z","update_time":"2014-05-16T15:53:39Z","state":"created","intent":"sale","payer":{"payment_method":"paypal","payer_info":{"shipping_address":{}}},"transactions":[{"amount":{"total":"1.00","currency":"USD","details":{"subtotal":"1.00"}},"description":"This is the payment description."}],"links":[{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-969088725C646431RKN3DJAY","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&amp;token=EC-77W22205RV5104528","rel":"approval_url","method":"REDIRECT"},{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-969088725C646431RKN3DJAY/execute","rel":"execute","method":"POST"}]}
  PayPal\Core\PPHttpConnection: Connecting to https://api.sandbox.paypal.com/v1/oauth2/token
  PayPal\Core\PPHttpConnection: Payload grant_type=client_credentials
  PayPal\Core\PPHttpConnection: Adding header User-Agent: PayPalSDK/rest-sdk-php 0.6.0 (lang=PHP;v=5.3.3;bit=64;os=Linux_2.6.32-358.2.1.el6.x86_64;machine=x86_64;openssl=1.0.1e-fips;curl=7.19.7)
  PayPal\Core\PPHttpConnection: Adding header Authorization: Basic QWRvemloQmxyYkNaNFNTOFNnQXczZjBlSHdKaXhSX0p4NkFWTVFVeUdGTUFQX0NnY2JRYm5UWXBDQmY4OkVIdmlkUkM3c2lkYXVaZjA3MnBITXp1Z1J3VHlXaGV3bUtKSFhMaFkzM0ZUWDF4WWc0UWpQbGZoR1hDVw==
  PayPal\Core\PPHttpConnection: Adding header Accept: */*
  PayPal\Core\PPHttpConnection: Connecting to https://api.sandbox.paypal.com/v1/payments/payment/execute
  PayPal\Core\PPHttpConnection: Payload 
  PayPal\Core\PPHttpConnection: Adding header Content-Type: application/json
  PayPal\Core\PPHttpConnection: Adding header User-Agent: PayPalSDK/rest-sdk-php 0.6.0 (lang=PHP;v=5.3.3;bit=64;os=Linux_2.6.32-358.2.1.el6.x86_64;machine=x86_64;openssl=1.0.1e-fips;curl=7.19.7)
  PayPal\Core\PPHttpConnection: Adding header Authorization: Bearer A015td4Q1TA1DUZ2e2Vh-3nGnXcFyBb3K6HRyjS6oZtDBII
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>--------------------<strong>SOLVED</strong>--------------------</p>
  
  <p>The problem is in the path, it seems that using the "payment" word in the url causing the 404 error.</p>
  
  <p>Changing </p>
  
  <pre><code>$redirectUrls-&gt;setReturnUrl("http://mysite/prova/public/payment/execute")
              -&gt;setCancelUrl("http://mysite/prova/public/payment/problema");
  </code></pre>
  
  <p>in</p>
  
  <pre><code>$redirectUrls-&gt;setReturnUrl("http://mysite/prova/public/pagamento/execute")
              -&gt;setCancelUrl("http://mysite/prova/public/pagamento/problema");
  </code></pre>
  
  <p>problem solved... but I don't know why</p>