-2
"links": [
    {
      "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-1B56960729604235TKQQIYVY",
      "rel": "self",
      "method": "GET"
    },
    {
      "href": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-60385559L1062554J",
      "rel": "approval_url",
      "method": "REDIRECT"
    },
    {
      "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-1B56960729604235TKQQIYVY/execute",
      "rel": "execute",
      "method": "POST"
    }
  ]
}

Here is what I tried:

$responseurl = json_decode($responseurl, true);
echo $responseurl["links"]["href"][0];

I have tried multiple combinations such as $responseurl["links"][0] but there has been no luck, I am really hoping someone can help me as I am a little stuck!

Many thanks, John

1

1 Answer 1

4

By looking at json provided here, to access href from first element in array, it should be like:

echo $responseurl["links"][0]["href"];
Sign up to request clarification or add additional context in comments.

1 Comment

I can accept the answer in 12 minutes, please remind me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.