Jump to content

[HELP] Reading stuff with a socket


artsrun

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.