http://stackoverflow.com/questions/6911025/html-post-converted-to-curl-for-sites-fastspring-com-under-php-alway-returning-40
do you have idea on converting the code which works with fastspring.com
I am open for the paying for the script.
Regards
Raj
From: Abdur <anon83@gmail.com>
To: phpexperts@yahoogroups.com
Sent: Tue, August 2, 2011 9:21:35 PM
Subject: [phpXperts] Re: Tturn this post form into PHP code
Use curl.
If not familiar, google it.
--- In phpexperts@yahoogroups.com, "raj_corporatemunim" <raj_corporatemunim@...> wrote:
>
> -- 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.
>
No comments:
Post a Comment