<?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; cURL</title>
	<atom:link href="https://www.webmaster-source.com/tag/curl/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>4 Useful cURL Tricks</title>
		<link>https://www.webmaster-source.com/2012/12/26/4-useful-curl-tricks/</link>
		<comments>https://www.webmaster-source.com/2012/12/26/4-useful-curl-tricks/#comments</comments>
		<pubDate>Wed, 26 Dec 2012 11:28:09 +0000</pubDate>
		<dc:creator><![CDATA[Matt]]></dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.webmaster-source.com/?p=4927</guid>
		<description><![CDATA[cURL is pretty much the universal go-to tool for testing HTTP responses from the command line. If you&#8217;re not already familiar with it, here are a few handy things you can use it for. Checking Headers You can use cURL to see the headers sent in a request. I use this all the time to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a href="http://curl.haxx.se/">cURL</a> is pretty much the universal go-to tool for testing HTTP responses from the command line. If you&#8217;re not already familiar with it, here are a few handy things you can use it for.</p>
<h3>Checking Headers</h3>
<p>You can use cURL to see the headers sent in a request. I use this all the time to see if the headers I&#8217;m trying to send in a script are working right.</p>
<pre class="brush: bash; title: ; notranslate">
$ curl -I http://www.google.com
</pre>
<pre class="brush: bash; title: ; notranslate">
HTTP/1.1 200 OK
Date: Thu, 06 Dec 2012 02:45:58 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
(...)
</pre>
<h3>Sending POST Requests</h3>
<p>I was working on a project recently that involved receiving POST requests from a client script running on another server. Since there was no convenient HTML form to use to repeatedly test changes made to the API, I ended up using cURL. Sending POST data is a simple matter of passing an argument that looks something like a query string.</p>
<pre class="brush: bash; title: ; notranslate">
curl http://example.org/url-to-recieve-post-request -d &quot;name=Gandalf&amp;type=wizard&quot;;
</pre>
<p><span id="more-4927"></span></p>
<pre></pre>
<h3>Spoofing User Agents</h3>
<p>You can edit the user agent sent along with the request, which is another thing I&#8217;ve found useful in testing.</p>
<pre class="brush: bash; title: ; notranslate">
curl http://example.org -d &quot;name=Gandalf&amp;type=wizard&quot; --user-agent &quot;WordPress&quot;
</pre>
<h3>Downloading Files</h3>
<p>While my first instinct is usually to use <code>wget</code> to quickly snag a remote file, that particular package isn&#8217;t installed on every system. I don&#8217;t believe OS X includes it by default (though that&#8217;s nothing <a href="http://mxcl.github.com/homebrew/">Homebrew</a> can&#8217;t take care of), for example. cURL can also be used to quickly download and save a remote URL to your current directory.</p>
<pre class="brush: bash; title: ; notranslate">
curl -O http://wordpress.org/latest.zip
</pre>
]]></content:encoded>
			<wfw:commentRss>https://www.webmaster-source.com/2012/12/26/4-useful-curl-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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 00:23:13 by W3 Total Cache
-->