alkoleht Voice
Joined: 26 Jun 2011 Posts: 6
|
Posted: Sat Feb 07, 2015 3:10 pm Post subject: help with TCL fetching HTML code and HTTP 302 |
|
|
Hi.
I use web based php scripts that my bot reads and processes using simple regexp
It was working perfectly till recently i started running into HTTP 302 code and it broke my script, apparently my webhost did something on theyr side. The script uses procs that generate url, depending on proc used, that is passed to engine that connects and returns the html code to main proc. Then the proc processes the returned html code using simple regexp.
I am still complete noob when it comes to tcl so need help dealing with HTTP 302
Here is my very basic and simple engine that fetches html from URL passed to it:
| Code: |
proc proc:engine {url} {
set agent "Mozilla/4.75 (X11; U; Linux 2.2.17; i586; Nav)"
set http [::http::config -useragent $agent -urlencoding "utf-8"]
catch { set http [::http::geturl $url -timeout 50000]} error
set html [::http::data $http]
return $html
}
|
Can anyone help me to fix it please?
Thank you |
|