Hello, there is some information I currently have the Roku read off a website which does work if I have it read the final destination website directly but what I need to do is send the Roku to a different link/site first that redirects it back to the final destination site which of course works in a web browser but is there some Brightscript code I can use that will allow the Roku to wait until the final destination site is landed on then read the information off that page? if you need more information let me know. Thank you
roku is not a browser so i don’t imagine it handles the browser redirect. you probably need to parse that first response to get the redirect url then access that with a separate function.
Roku handles HTTP redirects automatically, if that’s what he was referring to, although the way the original question is worded I have no idea what he’s referring to.
Hello, yes, that is what I am referring to (I thought I worded it correctly
) but for some reason the redirect is not working correctly.
Can you please post me the code I need to be able to parse it properly? Thank you
The first page lands on a PHP script that redirects to the final destination
What is the php script returning to cause a redirection? If it’s using a normal 3xx HTTP status, this should be handled automatically by the Roku firmware.
–Mark
Sent you a PM to try and explain as I’m not sure what you mean. Thx
Please post your replies here so that others can benefit from and participate in the conversation.
–Mark
Ah, where is an “upvote” button when i wish for one ![]()
(one of the few things i miss from S.O. & co)
Some of the code is proprietary/private to the original developer so don’t think I can post it in a public forum. I don’t see a thread for Coders for Hire, is there one? I don’t mind giving a few hundred dollars a month if I can get the help I need. I didn’t get any response from the Coders for Hire thread I posted last month ![]()
There’s no need to post any code, just describe how it is doing the redirection in general terms.
Ok, I read your PM but I don’t understand it, since you’re not using terminology correctly. “Sending a url to a JSON IDArray” doesn’t make sense to me. You’re probably going to need to explain it here and answer questions about it. In any case it sounds like what you’re calling “redirection” is not using the HTTP 3xx redirection status codes.
–Mark
Hi Mark, the full url link is pumped through a PHP script re-direction so must be different that the regular HTTP re-direction
So what I need is the final destination page of text that you can see on the final landing page that I sent you in the PM which is “url” for the command below;
IDArray = getStreamId(url)
Let me know if you need more info.
“matrixebiz” wrote:
Hi Mark, the full url link is pumped through a PHP script re-direction so must be different that the regular HTTP re-direction
A PHP redirection script should just use 30x headers to redirect, sounds like you are doing something else which is why Brightscript doesn’t reach the final page.
You are either going to need to post an example URL showing what actually happens, or chunks of the PHP code for people to actually see what you are on about.
In the latest PM you sent me, you indicated that you have two ways to access your URL, http://URL1, and http://URL2?http://URL1, where the latter is using the script at URL2 to redirect to URL1. If you download each of those URLs yourself in a browser and look at the source, you will see that the first one just returns a plain JSON string, while the second one returns an HTML page, with some Javascript and HTML markup around the JSON string, and the JSON string is HTML-encoded, with & replaced by &, etc. If you want to extract and use the JSON string from the second result, you’ll have to either parse it out of the HTML yourself and decode it, or change the server so that URL2 just returns the raw result of URL1 without wrapping it in HTML.
–Mark
Okay, I think I can decode it but how do I parse it out of the HTML? Thx
you need to know how to write PHP and do the re-direct there. No, i do not know nor care about PHP but just this once will illustrate (because i can use google, cue http://stackoverflow.com/questions/768431 , http://stackoverflow.com/questions/8469767 ![]()
<?php
header('Location: ' . $_SERVER['QUERY_STRING']);
?>
Now, if you had the above script at URL2, then trying to load http://URL2?http://URL1 (per RokuMarkn’s description) on Roku should “automaGically” return you the contents of URL1.
The purpose of the whole exercise eludes me however. It smells of something that a spam, malware or copyright circumvention artist would do - so respectfully, i am out of here.
