Skip to content

Magento : Create Fake POST

$array_post = array(
				'var1'=>'content1',
				'var2'=>'content2',
				
			);
		
		$array_post = http_build_query($array_post);
		
		$opts = array('http' =>
			array(
				'method'  => 'POST',
				'header'  => 'Content-type: application/x-www-form-urlencoded',
				'content' => $array_post
			)
		);

		$context = stream_context_create($opts);

		$result = file_get_contents(Mage::getUrl('controller/index/targetpost'), false, $context);
		
		echo $result;

 

Comments are closed.