<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);
print(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!" ));