mIRC Homepage
Posted By: TheCat Socket downloads .php file only half. - 15/10/04 05:52 PM
I'm making a script to search for profiles on a livejournal kind of site. There is a .php script on the server for scripts, which has a format like this:

# "nr of nicks"
<br>nick<br>nick<br>nick<br>...

I'm reading this file with a simple socket read, i let it read the line to a %var and then write the %var to a .txt file.
But when I check the text file, I only see the http info, the # nr, and then it stops. When I check the var, it has the # line in it.

Any idea on solving this? Here's the script: (I'm using a dialog to get the search terms in variables, but I've checked that, it works. The number of found nicks is also > 0. It opens the socket once all the vars have been set.)

Code:
 on *:sockopen:Noxazoek: {
  sockwrite -n $sockname GET /_dump/profielzoek1.php?&amp;functie=zoekprofiel&amp;zoekleeftijdmin= $+ %minage $+ &amp;zoekleeftijdmax= $+ %maxage $+ &amp;zoeklocatie= $+ %woonplaats $+ &amp;zoekstatus= $+ %status $+ &amp;zoekgeslacht= $+ %geslacht HTTP/1.1
  sockwrite -n $sockname Host: www.noxa.net $+ $crlf $+ $crlf
}
on *:sockread:Noxazoek: {
  sockread %zoek
  write Noxa\profielzoek.txt %zoek
} 


(Just a simple, regular socket script as you can see.)
Posted By: TheCat Re: Socket downloads .php file only half. - 16/10/04 01:39 PM
anyone? ^^;
Posted By: TheCat Re: Socket downloads .php file only half. - 16/10/04 05:12 PM
I made a loop for the read, because lines in a php file don't end in a $crlf, and it works now, but the second line is usually too long

any ideas on how to seperate it?

Edit: I tried replacing the <br> by a space or a comma. It works, but sometimes the <br> gets seperated over two lines, and not replace or one of the nicks gets seperated over two lines, which would make it kind of impossible to /echo correctly. Help?
Posted By: Davman Re: Socket downloads .php file only half. - 17/10/04 01:28 AM
If you specify the -f switch with a %var variable, this forces mIRC to fill the %var variable with whatever text is in the receive buffer, even if it doesn't end in a $crlf.

Possibly do that instead of splitting.
Posted By: TheCat Re: Socket downloads .php file only half. - 17/10/04 06:43 AM
I did, and now it reads everything to the txt file

But how do I get it to not split the lines at random points?
Posted By: TheCat Re: Socket downloads .php file only half. - 17/10/04 02:50 PM
Never mind, I got a solution.

I halt the script if there is more than one line of nicks.
© mIRC Discussion Forums