First thing to note here is that update_with_media is deprecated, so you should look at how we now recommend you upload media with Tweets.
Secondly, you won’t be able to retrieve that URL in a browser - firstly because it requires a POST not a GET, and secondly because you need OAuth in code.
What is happening in your code?