Dynamo

2 replies to this thread. Most Recent

JDW

18 Aug 2015, 12:01 am

[Pro] Automatically Load Web Page & Click Link

Consider the following web page, that has a single text link on it:

http://macusa.net/KIRAMEKdb/

That is not my web site, and therefore I have no control over the content of that web page.

The name of that text link won’t change, but the URL will change.

AIM: I want to create LINK (button, text link, whatever) on a page on MY web site (using Freeway, of course), that, when clicked, will go to the above macusa page and automatically follow the link posted there.

Another way to think of it would be to have code which opens the KIRAMEKdb page and automatically clicks the link.

I assume this could be achieved with PHP, cURL and perhaps a line of JavaScript, but what are your suggestions?

Again, I have my existing web page in Freeway, on which I intend to create a LINK that when clicked will automatically grab the URL of the link on that macusa page and open it in the same browser window.

How would I accomplish this task?

Thanks.

waltd

19 Aug 2015, 12:25 am

Well, first off, JavaScript absolutely is prohibited from doing this by the Same Origin Policy. PHP could do it, and I would have a look at phpQuery, which is a jQuery-influenced wrapper around LibXML for doing “screen-scraping” sorts of things like this.

Is this page subject to change? If not, just copy the URL out of it and apply it to your button on your page. It seems to work here when I do that.

If you know that the page will only ever have that one link on it, then I would periodically look at the page, compare it with a cached version, and if it has changed, update the cache. Then simply rewrite the link on your page (again, using PHP) to point to the link you want to go to.

Walter

On Aug 17, 2015, at 8:01 PM, JDW <[email protected]> wrote:

Consider the following web page, that has a single text link on it:

http://macusa.net/KIRAMEKdb/

That is not my web site, and therefore I have no control over the content of that web page.

The name of that text link won’t change, but the URL will change.

AIM: I want to create LINK (button, text link, whatever) on a page on MY web site (using Freeway, of course), that, when clicked, will go to the above macusa page and automatically follow the link posted there.

Another way to think of it would be to have code which opens the KIRAMEKdb page and automatically clicks the link.

I assume this could be achieved with PHP, cURL and perhaps a line of JavaScript, but what are your suggestions?

Again, I have my existing web page in Freeway, on which I intend to create a LINK that when clicked will automatically grab the URL of the link on that macusa page and open it in the same browser window.

How would I accomplish this task?

Thanks.

Freeway user since 1997

http://www.walterdavisstudio.com

Back to Top

JDW

19 Aug 2015, 12:38 am

Thank you for the advice, Walter. I will ponder it.

—James W.