artsrun Posted January 7, 2009 Share Posted January 7, 2009 Hello I really don't know much about php, just some. Well i am trying to fetch links from a website that has them protected by both javascript and php. I did little research and found i can use a socket to read it (I don't know much about sockets). Here is a example of how their code looks like. <a class="atest" target="_blank" href="#" onclick="popup0x(180358);this.style.color='#AE3939';this.style.textDecoration='line-through';return false"> <b>The link</b></a> I want to have my php parser to go to the site and use a socket to call the javascript function on their site and get the url that opens. How can i do this? Thank you Quote Link to comment Share on other sites More sharing options...
corbin Posted January 7, 2009 Share Posted January 7, 2009 No offense, but you obviously don't know anything about sockets if you want a socket to call a javascript function x.x. You will need to parse the javascript using some other language. Or, if your computer has a JS parser (if you're on the internet, it does), you could always try to use that, but you would have to coax the hell out of it. Quote Link to comment Share on other sites More sharing options...
artsrun Posted January 7, 2009 Author Share Posted January 7, 2009 No offense, but you obviously don't know anything about sockets if you want a socket to call a javascript function x.x. You will need to parse the javascript using some other language. Or, if your computer has a JS parser (if you're on the internet, it does), you could always try to use that, but you would have to coax the hell out of it. I talked to some guy who is guru in most languages and he said it can be done with php using a socket to read stream it or something like that. Then using php to parse the info. Quote Link to comment Share on other sites More sharing options...
artsrun Posted January 8, 2009 Author Share Posted January 8, 2009 bump? Quote Link to comment Share on other sites More sharing options...
btherl Posted January 8, 2009 Share Posted January 8, 2009 I'm guessing that he's suggesting you fetch the page using php and parse it with php. There's a few ways to fetch the page, depending on how much control you need. If it's just a simple request, you can use file_get_contents("http://www.blah.com/blah.html?arg=foo"); If it's a post, you probably need to use curl (you can google that). As for the parsing, that depends on what the javascript looks like. Quote Link to comment Share on other sites More sharing options...
artsrun Posted January 8, 2009 Author Share Posted January 8, 2009 I'm guessing that he's suggesting you fetch the page using php and parse it with php. There's a few ways to fetch the page, depending on how much control you need. If it's just a simple request, you can use file_get_contents("http://www.blah.com/blah.html?arg=foo"); If it's a post, you probably need to use curl (you can google that). As for the parsing, that depends on what the javascript looks like. For parsing i put a small curl script that can get the stuff i just need to find a way to call the function on their site, for example onclick="popup0x(180358) and get the url that opens. Also thank you for helping Quote Link to comment Share on other sites More sharing options...
artsrun Posted January 10, 2009 Author Share Posted January 10, 2009 bump Quote Link to comment Share on other sites More sharing options...
btherl Posted January 11, 2009 Share Posted January 11, 2009 popup0x() will either be on the page itself, or in another page included from that page (probably in the head section at the top). Quote Link to comment Share on other sites More sharing options...
artsrun Posted January 12, 2009 Author Share Posted January 12, 2009 huh? Quote Link to comment Share on other sites More sharing options...
btherl Posted January 12, 2009 Share Posted January 12, 2009 popup0x() is a javascript function. It must be defined somewhere. Either it is defined on the same page, or on a page included by that page. You need to find where it's defined so you can see what it does. Quote Link to comment Share on other sites More sharing options...
artsrun Posted January 13, 2009 Author Share Posted January 13, 2009 Its defined on a dif page and uses php as well. So even if i download entire site in html it wont work. Quote Link to comment Share on other sites More sharing options...
btherl Posted January 14, 2009 Share Posted January 14, 2009 Buy "uses php" do you mean it makes an ajax call back to a php script? popup0x() itself is a javascript function, so you should be able to download that one even if it's in another page. Whether you can get anything useful from the definition is another question.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.