Jump to content

HTTP: Difference between revisions

44 bytes added ,  15 years ago
m
<code> now allows reasonable placement of the tags (and <pre> always allowed it anyway)
No edit summary
m (<code> now allows reasonable placement of the tags (and <pre> always allowed it anyway))
Line 100:
=={{header|Java}}==
 
<code java>import java.util.Scanner;
import java.util.Scanner;
import java.net.URL;
 
Line 109 ⟶ 110:
while( sc.hasNext() ) System.out.println(sc.nextLine());
}
}
}</code>
 
Apache Commons IO
 
<code java>import org.apache.commons.io.IOUtils;
import org.apache.commons.io.IOUtils;
import java.net.*;
 
Line 120 ⟶ 123:
IOUtils.copy(new URL("http://rosettacode.org").openStream(),System.out);
}
}
}</code>
 
=={{header|Perl}}==
 
<code perl>using LWP::Simple;
using LWP::Simple;
print get("http://www.rosettacode.org");</code>
</code>
 
=={{header|PHP}}==
 
<code php>
<code php>print(file_get_contents("http://www.rosettacode.org"));</code>
</code>
 
=={{header|Python}}==
 
<code python>import urllib
import urllib
url = urllib.urlopen("http://www.rosettacode.org")
print url.read()
url.close()</code>
</code>
 
<code python>import urllib
import urllib
print urllib.urlopen("http://rosettacode.org").read()</code>
</code>
 
=={{header|Ruby}}==
 
<code ruby>require 'open-uri'
require 'open-uri'
require 'kconv'
 
puts open("http://rosettacode.org").read</code>
</code>
 
=={{header|Tcl}}==
<pre>
<pre>package require http
set request [http::geturl "http://www.rosettacode.org"]
puts [http::data $request]</pre>
</pre>
 
=={{header|UNIX Shell}}==
<code bash>
<pre>wget http://www.rosettacode.org -O tmp -o /dev/null
cat tmp
rm tmp</pre>
</code>
or
<code bash>
curl -s http://www.rosettacode.org/
</code>
973

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.