PriMoThemes — now s2Member® (official notice)
This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™
<?php
error_reporting(E_ALL);
@ini_set ("display_errors", true);
/*
Curl operation for posting data and reading response.
*/
function curlpsr ($url = FALSE, $postvars = array (), $max_con_secs = 20, $max_stream_secs = 20, $headers = array ())
{
if (($url = trim ($url)) && ($c = curl_init ()))
{
if (is_array ($postvars)) /* Because cURL can't deal with complex arrays. */
/* Since cURL can't deal with complex arrays, we force this to a query string. */
$postvars = http_build_query ($postvars);
/**/
curl_setopt_array ($c, /* Configure options. */
array (CURLOPT_URL => $url, CURLOPT_POST => true,/**/
CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5,/**/
CURLOPT_CONNECTTIMEOUT => $max_con_secs, CURLOPT_TIMEOUT => $max_stream_secs, /* Initial connection & stream seconds. */
CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $postvars,/**/
CURLOPT_ENCODING => "", CURLOPT_VERBOSE => false, CURLOPT_FAILONERROR => true, CURLOPT_FORBID_REUSE => true, CURLOPT_SSL_VERIFYPEER => false));
/**/
$o = trim (curl_exec ($c));
/**/
curl_close($c);
}
/**/
return (!empty ($o)) ? $o : false;
}
/*
Here we perform the PHP test routine.
*/
echo (curlpsr ("https://www.paypal.com/", array ("x_test" => 1))) ? '<div>Test succeeded :-) Lookin\' good here.</div>' : '<div>Sorry, this test failed!</div>';
?>
Users browsing this forum: Google [Bot] and 2 guests