<?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>Webburners &#187; php curl</title>
	<atom:link href="http://www.webburners.com/tag/php-curl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webburners.com</link>
	<description>We Burn the web with our expertise</description>
	<lastBuildDate>Thu, 08 Apr 2010 12:53:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Remotely login script throw curl in php</title>
		<link>http://www.webburners.com/2009/04/remotely-login-script-throw-curl-in-php/</link>
		<comments>http://www.webburners.com/2009/04/remotely-login-script-throw-curl-in-php/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 18:23:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[login using curl]]></category>
		<category><![CDATA[php curl]]></category>
		<category><![CDATA[remote login]]></category>

		<guid isPermaLink="false">http://www.webburners.com/?p=279</guid>
		<description><![CDATA[As we know php doesnt cum up with curl support by default for this u have to download a separte module libcurl which is basically for php. Using curl you can login to another site , grab the data and then log it off , just like a simple user do , you can use [...]]]></description>
			<content:encoded><![CDATA[<p>As we know php doesnt cum up with curl support by default for this u have to download a separte module libcurl which is basically for php. Using curl you can login to another site , grab the data and then log it off , just like a simple user do , you can use the below script for login to another site using curl</p>
<p><!--ec1-->&lt;?php<br />
// INIT CURL<br />
$ch = curl_init();</p>
<p>// SET URL FOR THE POST FORM LOGIN<br />
curl_setopt($ch, CURLOPT_URL, &#8216;http://www.external-site.com/Members/Login.php&#8217;);</p>
<p>// ENABLE HTTP POST<br />
curl_setopt ($ch, CURLOPT_POST, 1);</p>
<p>// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD<br />
curl_setopt ($ch, CURLOPT_POSTFIELDS, &#8216;fieldname1=fieldvalue1&amp;fieldname2=fieldvalue2&#8242;);</p>
<p>// IMITATE CLASSIC BROWSER&#8217;S BEHAVIOUR : HANDLE COOKIES<br />
curl_setopt ($ch, CURLOPT_COOKIEJAR, &#8216;cookie.txt&#8217;);</p>
<p># Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL<br />
# not to print out the results of its query.<br />
# Instead, it will return the results as a string return value<br />
# from curl_exec() instead of the usual true/false.<br />
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);</p>
<p>// EXECUTE 1st REQUEST (FORM LOGIN)<br />
$store = curl_exec ($ch);</p>
<p>// SET FILE TO DOWNLOAD<br />
curl_setopt($ch, CURLOPT_URL, &#8216;http://www.external-site.com/Members/Downloads/AnnualReport.pdf&#8217;);</p>
<p>// EXECUTE 2nd REQUEST (FILE DOWNLOAD)<br />
$content = curl_exec ($ch);</p>
<p>// CLOSE CURL<br />
curl_close ($ch);</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webburners.com/2009/04/remotely-login-script-throw-curl-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How curl is used in php</title>
		<link>http://www.webburners.com/2009/04/how-curl-is-used-in-php/</link>
		<comments>http://www.webburners.com/2009/04/how-curl-is-used-in-php/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 16:40:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tech Articles]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[how curl used]]></category>
		<category><![CDATA[php curl]]></category>
		<category><![CDATA[what is curl]]></category>

		<guid isPermaLink="false">http://www.webburners.com/?p=147</guid>
		<description><![CDATA[cURL is one of the most powerful PHP extensions. It stands for Client URL, and allows you to communicate with other servers using a large range of protocols.  Other servers and other protocols? At some stage in a novice developer&#8217;s career, there comes a time to break out of the local server, and cURL [...]]]></description>
			<content:encoded><![CDATA[<p>cURL is one of the most powerful PHP extensions. It stands for Client URL, and allows you to communicate with other servers using a large range of protocols.  Other servers and other protocols? At some stage in a novice developer&#8217;s career, there comes a time to break out of the local server, and cURL is the first thing you should consider. I first used cURL for quite a simple task &#8211; processing a file on an FTP server. Later for dealing with merchant payments to create a transparent way of handling credit card authentication. And later still as a convenient way to get data from Amazon.com. The possibilities are almost limitless. I haven&#8217;t even scratched the surface of what cURL can do, but for certain it&#8217;s a powerful library.</p>
<p>libcurl (the library behind the PHP cURL extension) currently supports a wide range of protocols, including HTTP, HTTPS, FTP, TELNET, FILE, LDAP, DICT, GOPHER and HTTPS, as well as HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, and user:password authentication. There are alternatives for some of these, such as streams, sockets or the FTP extension, but cURL is the master of them all &#8211; they are less flexible, and don&#8217;t perform as well. </p>
<p>A first cURL script<br />
Let&#8217;s dive right in with a simple script.</p>
<p><?php<br />
//examle.php</p>
<p>// initialise the cURL session, passing an optional URL<br />
$ch = curl_init('http://www.ex.com/doc.php');</p>
<p>//Execute the session<br />
curl_exec($ch);</p>
<p>//Close the cURL session<br />
curl_close($ch);<br />
?></p>
<p>The recipient script is:</p>
<p><?php<br />
// recipient.php</p>
<p>print "Welcome, visitor from  {$_SERVER['REMOTE_ADDR']}";<br />
?></p>
<p>The example.php script connects to the URL supplied (doc.php), handing over control to that script. Not particularly useful, but it introduces you to three of the main functions: curl_init(), which returns a cURL handle (hence the results are usually assigned to a variable called $ch), curl_exec(), which executes the session you&#8217;ve set up, and curl_close(), which frees all resources associated with the session. curl_exec() returns a boolean in the above context, but most often you will ask it to return the output from the call, which we look at later.</p>
<p>A simple cURL script to look up the meaning of a word<br />
Let&#8217;s look at a more practical use. One of the protocols cURL supports is dict. In this example, we&#8217;ll create a simple tool to return the definition of a word from dict.org&#8217;s database, connecting to dict.org with the dict protocol. Using something similar you can create an online dictionary, or integrate a word search into other applications. This article is not about using forms to submit values to a PHP script &#8211; I assume you already know how to do that, and can build upon this skeleton, taking proper care to validate all variables.</p>
<p><html><br />
<body></p>
<form action="example1.php" method="POST">
Please enter a word: </p>
<input type="text" name="word">
<input type="submit">
</form>
<p></body><br />
</html></p>
<p><?php<br />
// example1.php</p>
<p>//get the word submitted from the form<br />
$word = addslashes($_POST['word']);</p>
<p>// validate the word<br />
if ($word != '') {</p>
<p>    // initialise the session, this time with no URL<br />
    $ch = curl_init();</p>
<p>    // Set the URL, which includes $word, and is of the dict protocol<br />
    curl_setopt($ch, CURLOPT_URL, "dict://dict.org/d:($word)");</p>
<p>    // Return the output from the cURL session rather than displaying in the browser.<br />
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);</p>
<p>    //Execute the session, returning the results to $definition, and close.<br />
    $definition = curl_exec($ch);<br />
    curl_close($ch);</p>
<p>    //display the results - I'll leave the formatting to you<br />
    print "Definition of $x: $definition";<br />
}<br />
?></p>
<p>The new function introduced here is curl_setopt(). This takes a cURL handle, an option and a value for this option as arguments. $ch is of course the handle, while we introduce two of the options, CURLOPT_URL and CURLOPT_RETURNTRANSFER. CURLOPT_URL takes the URL for the script to fetch, and can also be set by passing the argument to curl_init(), as we did in the previous example. CURLOPT_RETURNTRANSFER is also one you&#8217;ll probably be using most of the time &#8211; setting it to true returns the results as a string for processing in your script, rather than just simply displaying it, as in the previous example. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.webburners.com/2009/04/how-curl-is-used-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
