Geek Posted April 9, 2011 Posted April 9, 2011 <div class="KonaBody"><p>This should be a helpful tip for the web developers out there. Using curl and pbcopy, we can quickly grab and copy HTML and CSS code from any URL via the <a href="http://osxdaily.com/category/command-line/">command line</a>.</p> <p>Getting HTML is just a matter of pointing curl to the URL in question:</p> <p><code>curl "http://google.com/" | pbcopy</code></p> <p>The HTML will now be in your clipboard for you to paste anywhere else.</p> <p>Grabbing the CSS requires you to specify where the CSS file is located, otherwise the command is the same:</p> <p><code>curl "http://google.com/css/stylesheet.css" | pbcopy</code></p> <p>We’ve covered <a href="http://osxdaily.com/2007/03/05/manipulating-the-clipboard-from-the-command-line/">pbcopy & pbpaste</a> a while ago, they’re just command line interfaces for the Mac OS X clipboard but combined with other scripts or utilities can be quite powerful.</p> <p>If you want to go a step further, you can also <a href="http://osxdaily.com/2009/03/19/how-to-easily-mirror-an-entire-web-site-locally/">quickly mirror a website locally using wget</a> or <a href="http://osxdaily.com/2011/04/04/quickly-backup-a-site-through-ftp-with-wget/">backup through FTP with wget</a>. </p> </div> <p><a href="http://feedads.g.doubleclick.net/~a/BuRoPO4JZOjD-ukjvwAu_rwp9dY/0/da"><img src="http://feedads.g.doubleclick.net/~a/BuRoPO4JZOjD-ukjvwAu_rwp9dY/0/di" border="0" ismap="true"></img></a><br/> <a href="http://feedads.g.doubleclick.net/~a/BuRoPO4JZOjD-ukjvwAu_rwp9dY/1/da"><img src="http://feedads.g.doubleclick.net/~a/BuRoPO4JZOjD-ukjvwAu_rwp9dY/1/di" border="0" ismap="true"></img></a></p><div class="feedflare"> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PPgEd6fqHEA:_dRr_L4ukKg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PPgEd6fqHEA:_dRr_L4ukKg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=PPgEd6fqHEA:_dRr_L4ukKg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PPgEd6fqHEA:_dRr_L4ukKg:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=PPgEd6fqHEA:_dRr_L4ukKg:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PPgEd6fqHEA:_dRr_L4ukKg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PPgEd6fqHEA:_dRr_L4ukKg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a> </div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/PPgEd6fqHEA" height="1" width="1"/> View the full article
Recommended Posts