<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Webmaster-Source &#187; console</title>
	<atom:link href="https://www.webmaster-source.com/tag/console/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.webmaster-source.com</link>
	<description>Useful Resources For Webmasters</description>
	<lastBuildDate>Thu, 24 Aug 2017 02:01:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>cURL From the Console</title>
		<link>https://www.webmaster-source.com/2009/03/20/curl-from-the-console/</link>
		<comments>https://www.webmaster-source.com/2009/03/20/curl-from-the-console/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 12:33:24 +0000</pubDate>
		<dc:creator><![CDATA[Matt]]></dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.webmaster-source.com/?p=1955</guid>
		<description><![CDATA[cURL is often used on the server end to pull web pages and RSS feeds for parsing, or for interacting with APIs. It&#8217;s a nifty tool, and one that I use quite frequently. cURL also can be used, in a command line environment, to do some useful things that come in handy when troubleshooting. A [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a href="http://curl.haxx.se/">cURL</a> is often used on the server end to pull web pages and RSS feeds for parsing, or for interacting with APIs. It&#8217;s a nifty tool, and one that I use quite frequently.</p>
<p>cURL also can be used, in a command line environment, to do some useful things that come in handy when troubleshooting.</p>
<p><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-full wp-image-1956" title="cURL From The Console" src="//www.webmaster-source.com/wp-content/uploads/curl-console-i-1.jpg" alt="cURL From The Console" width="500" height="328" /></p>
<p><span id="more-1955"></span>A few months ago a website I do some occasional work on had been infiltrated by a crafty hacker bent on spreading malware. If you visited the website directly, everything looked fine. But if you went to Google or Yahoo, searched for the site, and clicked through, you would be redirected to a page on a server that would attempt to install one of those fake antivirus malware applications. (The site ranked well too, and got at least half of it&#8217;s traffic from search engines.)</p>
<p>I ended up talking to the Google Security team about the problem, and they discovered that the attacker had put some code <em>somewhere</em> on the site that would check the referer [sic] header to see if a visitor was coming from Google or Yahoo, and redirect if they were. A trick like that would cause it to take a lot more time for a site&#8217;s operator to discover the problem. I later tracked down the little XSS attack, which was related to a forum vulnerability, and fixed the problem.</p>
<p>How did Google Security diagnose the site? They used cURL from a command line. They typed, at their Linux/UNIX/Mac system&#8217;s prompt:</p>
<p><code>curl -v --referer http://www.google.com/ www.example.com | more</code></p>
<p>Then they compared the output to that of</p>
<p><code>curl -v www.example.com | more</code></p>
<p>The first one returned the HTML source for a page with a JavaScript redirect to the malware site, while the second one did not. The <code>--referer</code> flag allowed them to pretend that the request they were sending was a user clicking through from Google. (The &#8220;<code>| more</code>&#8221; part is a *nix command to paginate the output so it doesn&#8217;t scroll by faster than you can read it.)</p>
<p>Neat trick, isn&#8217;t it?</p>
<p>While working on GoCodes recently, I was doing some work with PHP&#8217;s <a href="http://php.net/header"><code>header()</code></a> function. The messages it sends to applications requesting the page aren&#8217;t usually visible to users, so how was I to tell if the headers I was sending were working properly? I turned to cURL. I would access a GoCodes URL from cURL like this:</p>
<p><code>curl -I http://www.webmaster-source.com/go/whatisrss/</code></p>
<p>The command would return the headers sent by the page. The date, the server software, the character set, and any other headers I was sending, such as the <a href="http://googleblog.blogspot.com/2007/07/robots-exclusion-protocol-now-with-even.html"><code>X-Robots-Tag</code></a> header.</p>
<p>cURL is a great diagnostics tool as well as a page-fetching application for scripts. It can do a lot, and has a lot of uses. Type <code>curl --help</code> at the command line to see all of it&#8217;s capabilities.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.webmaster-source.com/2009/03/20/curl-from-the-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/


Served from: www.webmaster-source.com @ 2026-06-10 03:26:39 by W3 Total Cache
-->