All pastes #258754 Raw Edit

Something

public text v1 · immutable
#258754 ·published 2006-11-26 20:40 UTC
rendered paste body
ON *:TEXT:!Price*:#: {
  set %price.nick .notice $nick
  set %price.item $replace($$2-,$chr(32),+)
  set %price.item2 $2-
  if $sock(price) { /sockclose price }
  else {
    /sockopen price zybez.net 80
  }
}

on *:sockopen:price: {
  sockwrite -nt $sockname GET /priceguide.php?search_terms= $+ %price.item $+ &search_area=1&price_low=&price_high=&member=1 HTTP/1.1
  sockwrite -nt $sockname HOST: zybez.net $+ $crlf $+ $crlf
}

on *:sockread:price: {
  if $sockerr {
    %price.nick there was an error during the socket reading process ( $+ $sockerr $+ ) of Price
    unset %price.nick
    unset %price.item
    halt
  }
  else {
    var %output
    sockread -f %output
    if (*"tablebottom"><a href="/priceguide.php?* iswm %output) {
      set %output2 $remove($htmlfree(%output),&amp;)
      //echo -a %output2
    }
    else { 
      set %output2 Not Found.
    }
    if (*<!--name-->* iswm %output) {
      set %output1 $htmlfree(%output)
    }
    if (*gp* iswm %output) {
      set %output $htmlfree(%output)
      %price.nick 2[5Priced-Item2]2 %output1
      %price.nick 2[5Results2]2 %output 5| 2[5Catagory2]2 %output2
      unset %price.nick 
      unset %price.item 
      unset %output
      unset %output1
      sockclose price
      halt 
    }
    if (<td class="tablebottom" colspan="5">* iswm %output) {
      %price.nick 2[5Priced-Item2]2 %price.item2
      %price.nick 2[5Results2]2 Your search did not return any results. Please make sure your spelling is correct and that you are typing full words.
    }
  }
}

alias -l htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) 
  return %x 
}