Monday, August 1, 2011

[phpXperts] Tturn this post form into PHP code

 

-- changed the website url to which to post --

<form method="POST" action="http://sites.fastspring.com/YourCompanyOrAccountName/api/order">
<input type="hidden" name="operation" value="create"/>
<input type="hidden" name="destination" value="checkout"/>
<p><input type="hidden" name="product_1_path"
value="/productPathGoesHere">
<input type="text" name="product_1_quantity" value="0"/> 1234-ABCD</p>
<p><input type="submit" value="Order Now"/></p>
</form>

I have tried

if (!function_exists('fopen'))
{echo' not allowd fopen ';}

$params = array('http' => array(
'method' => 'post',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}
return $response;
}

but does not work and throws exception, am I doing something wrong or there is alternate way to do it or can it be issue with hosting, I am using 1and1.

Any help is appreciated.

__._,_.___
Recent Activity:
Visit phpXperts website at www.phpxperts.net
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

No comments: