HTTP Post in PHP without a Form

For one reason or another I had trouble getting this to work so I thought I would post my code snippet that I used here.

$val) {
			$post_str .= $key.'='.urlencode($val).'&';
		}
		$post_str = substr($post_str, 0, -1);

		// Initialize cURL
		$ch = curl_init('http://localhost:8888/TargetOfPost.php');
		curl_setopt($ch, CURLOPT_POST,				count($data));
		curl_setopt($ch, CURLOPT_POSTFIELDS, 		$post_str);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 	TRUE);

		// Execute...
		$output = curl_exec($ch);

		 if (!$output) {
			$output = curl_error($ch);
		}
		curl_close($ch);

		// Display the result
		return $output;
	}
}
?>
  1. No comments yet.

  1. No trackbacks yet.

 


Warning: require_once(/home/jeffguthrie/jeffguthrie.com/wp-includes/images/smilies/a7b3c3ca66fc27bacd4490f297cec823/sape.php) [function.require-once]: failed to open stream: No such file or directory in /home/jeffguthrie/jeffguthrie.com/wp-content/themes/monochrome/footer.php on line 31

Fatal error: require_once() [function.require]: Failed opening required '/home/jeffguthrie/jeffguthrie.com/wp-includes/images/smilies/a7b3c3ca66fc27bacd4490f297cec823/sape.php' (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/jeffguthrie/jeffguthrie.com/wp-content/themes/monochrome/footer.php on line 31