<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />tCall = 소켓 ();
rc = tCall << connect ( "URL", "80");
(rc [2] == "ok"이면
tCall << 보내기 (Char에서 Blob로
"GET / abc / 123 HTTP / 1.0 ~ 0d ~ 0a ~ 0d ~ 0a",
"ASCII ~ HEX"
));
tMessage = tCall << recv (486956);
print (tMessage);
텍스트 = 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!" ));