<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />tCall = Socket();
rc = tCall << connect(“URL”,“80”);
如果(rc [2] ==“ok”,
tCall << Send(Char To Blob(
“GET / abc / 123 HTTP / 1.0~0d~0a~0d~0a”,
“ASCII〜HEX”
));
tMessage = tCall << recv(486956);
打印(tMessage);
text = Blob To Char(tMessage [3],“utf-8”);
// tCall << Close();
文本;
,
RC [2]
);
嘗試這樣的事情:
tCall = Socket();rc = tCall << connect( "jmp.com", "80" );buffer = Char To Blob( "" );While( rc[2] == "ok", // loop to receive all the data tCall << Send( Char To Blob( "GET / HTTP/1.0~0d~0a~0d~0a", "ASCII~HEX" ) ); // 10000, below, is the max you'll get. You will get what ever is actually available, // which usually won't be everything because of far-end delay and transmission time. rc = tCall << recv( 10000 ); buffer = buffer || rc[3]; // concatenate all data);Show( rc ); // expecting {"recv", "CLOSED: no data received." ...text = Blob To Char( buffer, "utf-8" ); // convertShow( text );那段代碼不對。 這個更好:
tCall = Socket();rc = tCall << connect( "jmp.com", "80" );buffer = Char To Blob( "" );If( rc[2] == "ok", // connected OK? rc = tCall << Send( Char To Blob( "GET / HTTP/1.0~0d~0a~0d~0a", "ASCII~HEX" ) ); While( rc[2] == "ok", // loop to receive all the data // 10000, below, is the max you'll get. You will get what ever is actually available, // which usually won't be everything because of far-end delay and transmission time. rc = tCall << recv( 10000 ); buffer = buffer || rc[3]; // concatenate all data ); If( Left( rc[2], 7 ) == "CLOSED:", // ended as expected? text = Blob To Char( buffer, "utf-8" ); // convert Show( text ); // success! , Show( "error", rc ) );, Show( "could not connect!" ));