mIRC Home    About    Download    Register    News    Help

Print Thread
Using Sockets. #168113 03/01/07 11:08 PM
Joined: Aug 2005
Posts: 18
M
Mail Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Aug 2005
Posts: 18
I am trying to get information from a web site, my own, off of a forum where all the material is hidden for various reasons. Then I am going to display this information in a particular channel via mIRC. My problem is auth'ing to the server. Any ideas on how this can be accomplished. The forum uses phpbb2 and there is a login link on main index page.

Any assistance on this would be appreciated.

Re: Using Sockets. [Re: Mail] #168114 03/01/07 11:40 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
FiberOPtics wrote me a nice script for logging in and posting to a phpBB forum. You can find it here (note that the search brought me to a place further down the thread... you may want to scroll to the top and read from the beginning).

Now, this is for POSTING, but it logs you in, which is what you are trying to do. If you take the part that logs you in, then you can do a standard socket script to sockread the page(s) that you need. Keep in mind that everywhere that mentions by domain (kakkoiitranslations.net) will need to be changed to YOUR domain. Also, don't forget to change the login info.


Invision Support
#Invision on irc.irchighway.net
Re: Using Sockets. [Re: Riamus2] #168115 03/01/07 11:52 PM
Joined: Aug 2005
Posts: 18
M
Mail Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Aug 2005
Posts: 18
Thanks I will give it a try.

Re: Using Sockets. [Re: Mail] #168124 04/01/07 02:25 AM
Joined: Aug 2005
Posts: 18
M
Mail Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Aug 2005
Posts: 18
Ok I can get logged in alright, but for some reason the retrieval script isnt retrieving. The post part isnt working exactly as well. I made all the suggested changes and still no go. I can however login. So I am thinking I need to use php based commands for retrieving as well.

Re: Using Sockets. [Re: Mail] #168126 04/01/07 02:43 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Well, you'll need a GET in your sockopen event, similar to this:

Code:
on *:sockopen:socketname: {
  sockwrite -n $sockname get /path/page.php HTTP/1.0


First, you'll have to login before doing this, though. You should be able to find the right place to put the GET line. If not, post what you have after you've tried.

You will also need a sockread event to gather the data from the page:
Code:
on *:sockread:socketname: {
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    var %temptext
    sockread %temptext
    if (*<td style="width: 20%;"> iswm %temptext) {
      var %data = %temptext
    }


That's just a sample of the start of a sockread event. The IF section at the end should be changed to match whatever line(s) you want the data from and you may need to $gettok your line when setting the variable to get just the data you need. You can put multiple IF lines in there (add to the end... probably with ELSEIF instead of just IF) to get data from other lines that have a different matchtext.

So, after logging in, you need to GET the page, then sockread the page and parse it for the data you want.


Invision Support
#Invision on irc.irchighway.net