<?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>Truth &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/truth/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>HTTP POST with PHP without cURL</title>
		<link>/2010/09/08/http-post-with-php-without-curl/</link>
		<comments>/2010/09/08/http-post-with-php-without-curl/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 21:47:27 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Cross-platform software]]></category>
		<category><![CDATA[CURL]]></category>
		<category><![CDATA[Curly bracket programming languages]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Procedural programming languages]]></category>
		<category><![CDATA[Scripting languages]]></category>
		<category><![CDATA[Truth]]></category>

		<guid isPermaLink="false">/?p=1960</guid>
		<description><![CDATA[Awesome PHP It&#8217;s strange how powerful PHP can be. There&#8217;s a legend that cURL is the only way to perform a HTTP POST with PHP, but that isn&#8217;t the truth. An extremely useful script is by using stream_context_create: $optional_headers = null; $params = array('http' => array( 'method' => 'POST', 'content' => http_build_query(array('name' => 'my-name')))); if &#8230; <a href="/2010/09/08/http-post-with-php-without-curl/" class="more-link">Continue reading <span class="screen-reader-text">HTTP POST with PHP without cURL</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
<li><a href="/2010/05/17/php-the-array-element-doesnt-exist-suppress-the-warnings/" rel="bookmark" title="PHP: The Array Element Doesn&#8217;t Exist &#8211; Suppress the Warnings">PHP: The Array Element Doesn&#8217;t Exist &#8211; Suppress the Warnings </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Awesome PHP</h2>
<p><a href="/wp-content/uploads/2010/09/idea.jpeg"><img src="/wp-content/uploads/2010/09/idea.jpeg" alt="a great php idea!" title="idea" width="430" height="286" class="aligncenter size-full wp-image-1975" srcset="/wp-content/uploads/2010/09/idea.jpeg 430w, /wp-content/uploads/2010/09/idea-300x199.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a><br />
It&#8217;s strange how powerful PHP can be. There&#8217;s a legend that cURL is the only way to perform a HTTP POST with PHP, but that isn&#8217;t the truth. An extremely useful script is by using stream_context_create:</p>
<pre lang="php">
$optional_headers = null;
$params = array('http' => array(
                'method' => 'POST',
                'content' => http_build_query(array('name' => 'my-name'))));

if ($optional_headers !== null) {
    $params['http']['header'] = $optional_headers;
}

$ctx = stream_context_create($params);
$fp = @fopen('http://example.com/post.php', 'rb', false, $ctx);
</pre>
<p>Well this is only a snippet. You can change a lot this code and perform any request, but here&#8217;s a small start up. However note that this will do the same as while posting to example.com/post.php via web form!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
<li><a href="/2010/05/17/php-the-array-element-doesnt-exist-suppress-the-warnings/" rel="bookmark" title="PHP: The Array Element Doesn&#8217;t Exist &#8211; Suppress the Warnings">PHP: The Array Element Doesn&#8217;t Exist &#8211; Suppress the Warnings </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/09/08/http-post-with-php-without-curl/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
