mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2014
Posts: 27
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 27
Greetings and good afternoon ..

I have a problem with the socket to read a web

I have in my database a table called "sig"
my table has three fields, one called "id", the other is called "contenido" and the last is called "cafe".

Table - sig
"id"
"contenido"
"cafe"

And so my website is displayed:

Code:
www.****.com/si.php?cafe=azucar


And so printed on the website

Html:
<p> azucar es rico</p>


And in my remote I have:

Code:
on *:Text:*!akore*:#: {
  if ( $2 == $null ) {    .notice $nick La forma Correcta de usarlo es !akore <akore>  | return }
  if ( $istok(azucar1.azucar3.azucar3,$2,46) == $false ) { 
    .notice $nick  $nick el akore  $2   no es valido
    return 
  }
  akore $2
}

alias akore {
  sockclose akore3
  set %akore2 $chan
  set %akore $1
  sockopen akore3 www.****.com 80
}

on 1:sockopen:akore3: {
  sockwrite -tn $sockname GET si.php?contenido= $+ %akore
  ;sockwrite -tn $sockname Accept: *.*, *\/*
  ;sockwrite -tn $sockname Range: bytes=0-
  sockwrite -tn $sockname Host: www.****.com 80
  sockwrite -tn $sockname $crlf
}

on 1:sockread:akore3:{
  if ($sockerr > 0 ) {  return }
  sockread  %akore4
  if ($sockbr == 0 ) { return }
  if (%akore4 == $null) { halt }
  if (<p><img src="img/ $+ %akore $+ .jpg" isin %akore4) {
    set %akore4 $remove(%akore4,<p>,</p>,%akore,$chr(9))
    set %akore4 $replace(%akore4,ǁ,-,&aacute;,á,&eacute;,é,&iacute;,í,&oacute;,ó,&uacute;,ú,¡,¡,Á,Á,&ntilde;,ñ)
    set %akore4 $replace(%akore4,ñ,ñ,ó,ó,á,á,í,í,ú,ú,é,é,ü,ü,©,©,&laquo;,",&raquo;,",&nbsp,$chr(32))
    .timerhoros1 1 1 msg %akore2 4 Signo %akore - 
  .timerhoros2 1 1 msg %akore2 %akore4 }
}

on 1:sockclose:akore3: {
unset %akore4 %akore2 %akore }



But it does not work, not that I am wrong ...

Thank you

Joined: Nov 2014
Posts: 149
J
Vogon poet
Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Originally Posted By: nexux
Greetings and good afternoon ..

I have a problem with the socket to read a web

I have in my database a table called "sig"
my table has three fields, one called "id", the other is called "contenido" and the last is called "cafe".

Table - sig
"id"
"contenido"
"cafe"

And so my website is displayed:

Code:
www.****.com/si.php?cafe=azucar


And so printed on the website

Html:
<p> azucar es rico</p>


And in my remote I have:

Code:
on *:Text:*!akore*:#: {
  if ( $2 == $null ) {    .notice $nick La forma Correcta de usarlo es !akore <akore>  | return }
  if ( $istok(azucar1.azucar3.azucar3,$2,46) == $false ) { 
    .notice $nick  $nick el akore  $2   no es valido
    return 
  }
  akore $2
}

alias akore {
  sockclose akore3
  set %akore2 $chan
  set %akore $1
  sockopen akore3 www.****.com 80
}

on 1:sockopen:akore3: {
  sockwrite -tn $sockname GET si.php?contenido= $+ %akore
  ;sockwrite -tn $sockname Accept: *.*, *\/*
  ;sockwrite -tn $sockname Range: bytes=0-
  sockwrite -tn $sockname Host: www.****.com 80
  sockwrite -tn $sockname $crlf
}

on 1:sockread:akore3:{
  if ($sockerr > 0 ) {  return }
  sockread  %akore4
  if ($sockbr == 0 ) { return }
  if (%akore4 == $null) { halt }
  if (<p><img src="img/ $+ %akore $+ .jpg" isin %akore4) {
    set %akore4 $remove(%akore4,<p>,</p>,%akore,$chr(9))
    set %akore4 $replace(%akore4,ǁ,-,&aacute;,á,&eacute;,é,&iacute;,í,&oacute;,ó,&uacute;,ú,¡,¡,Á,Á,&ntilde;,ñ)
    set %akore4 $replace(%akore4,ñ,ñ,ó,ó,á,á,í,í,ú,ú,é,é,ü,ü,©,©,&laquo;,",&raquo;,",&nbsp,$chr(32))
    .timerhoros1 1 1 msg %akore2 4 Signo %akore - 
  .timerhoros2 1 1 msg %akore2 %akore4 }
}

on 1:sockclose:akore3: {
unset %akore4 %akore2 %akore }



But it does not work, not that I am wrong ...

Thank you


Si nos pasas cual es la página web, puedo intentar ayudarte.
Hace pocos días, con ayuda de este foro solucioné un problema similar.

Saludos

Joined: Nov 2014
Posts: 27
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 27
Gracias amigo, no se si tiene que ver algo en la codificacion de la pagina web, o sea del archivo php ... he probado con codificacion y sin codificacion, al decir codificacion me refiero al :
Html:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


Pero aun no puedo hacerla funcionar..

Joined: Nov 2014
Posts: 149
J
Vogon poet
Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Originally Posted By: nexux
Gracias amigo, no se si tiene que ver algo en la codificacion de la pagina web, o sea del archivo php ... he probado con codificacion y sin codificacion, al decir codificacion me refiero al :
Html:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


Pero aun no puedo hacerla funcionar..


nexus, como te comenté anteriormente, si no proporcionas la dirección de la web para que se pueda probar el socket, va ser dificil que alguien te pueda ayudar.

Sale: www.****.com/

Si no deseas dejarla pública en el post, la puedes poner con el spoiler, que es el icono de la (S) que está a la izquierda del icono de la comilla (").

Suerte

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Try use this code:

Code:
ON *:TEXT:!akore*:#: {
  if ($2 == $null) { .msg $chan  La forma Correcta de usarlo es !akore <akore>  | return }
  ; if ($istok(azucar1.azucar3.azucar3,$2,46) == $false) {
  ;   .msg $chan  $nick el akore  $2   no es valido
  ;   return
  ; }
  sockget http://***.com/si.php?cafe= $+ $2 $nick $chan
}

alias sockget {
  if (!$1-) { echo -ag ERROR: Enter the URL Page correctly! | return }
  var %s = sockget_ $+ $rand(1,100000) $+ _ $+ $ticks
  if ($sock(%s)) { sockclose %s }
  var %site = $1
  var %get_host = $chr(47) $+ $gettok(%site,3-,47)
  var %host = $gettok(%site,2,47)
  if ($right(%site,1) == $chr(47)) && ($right(%get_host,1) !== $chr(47)) { var %get_host = %get_host $+ $chr(47) }
  if (*https* iswm %site) { sockopen -e %s %host 443 }
  else { sockopen %s %host 80 }
  sockmark %s %get_host $iif($2-,$2-)
}

ON *:SOCKOPEN:sockget_*: {
  if ($sockerr) { echo -ag ERROR: SOCKOPEN -> $sock($sockname).wserr -> $sock($sockname).wsmsg | return }
  sockwrite -nt $sockname GET $gettok($sock($sockname).mark,1,32) HTTP/1.0
  sockwrite -n $sockname Host: $sock($sockname).addr
  sockwrite -n $sockname User-Agent: */*
  sockwrite -n $sockname Connection: Close
  sockwrite -nt $sockname $crlf
}

ON *:SOCKREAD:sockget_*: {
  if ($sockerr) { echo -ag ERROR: SOCKREAD -> $sock($sockname).wserr -> $sock($sockname).wsmsg | return }
  var %read
  sockread %read
  if ($sockbr) { 
    ; echo -ag DATA: $left(%read,4096)
    if (<p> isin %read) && (</p> isin %read) {
      .msg $gettok($sock($sockname).mark,3,32) [ $+ $gettok($sock($sockname).mark,2,32) $+ ]: $iif($remove(%read,<p>,</p>),$v1,Not any results founded)
    }
  }
}

ON *:SOCKCLOSE:sockget_*: { ;echo -ag CLOSED: $sock($sockname).addr SOCKET CONNNECTION! }    

Last edited by westor; 21/11/14 12:34 PM. Reason: requested to hide the website

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard