PayPal `rm` hidden value not returning POST data - post

<form action=" https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="paypalform" name="paypalform">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="abc#abc.com">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="currency_code" value="<?php echo $currency ?>">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="country" value="US">
<input type="hidden" name="return" value="http://abc-return.com">
<input type="hidden" name="cancel_return" value="http://abc-cancel.com">
<input type="hidden" name="item_name_1" value="Recharge">
<input type="hidden" name="item_number_1" value="<?php echo $user_id ?>">
<input type="hidden" name="amount_1" value="<?php echo $price ?>">
</form>
<script type="text/javascript">document.paypalform.submit();</script>
I'm using PayPal Payments Standard, via the HTML hidden name-value pair.
Payment was working great and smooth as butter until the 9th of this month, when things started getting worse. The return method rm = 2 was returning the post data to my return page before this date, but when I checked on 9th, the post data is not returning to my page.
I've spent more than a week and still can't figure out how could the same code works one day, and not the day afterwards.
I've implemented this method in my many other projects which could get me into trouble if the data is not posting back on my return page. Everything is just fine with my HTML forms, and I'm also receiving the payment on my PayPal Sandbox
The only issue is I'm not getting the post data on my return page.
Please help me resolve this.

Yes, I also confirm this issue. I am not certain if this is a Paypal change or a Paypal error - for it is difficult to find authoritative answers from them.
I also have a form that used to return POST data to the return url - however it recently stopped working and I was able to get it working again using GET method instead by following this helpful article.
However, this will require some changes to your IPN and success pages.
Curious to know how you solved your issue. Please update us.

Thanks for your update, however, I think there's some confusion here. The IPN url is called the notify_URL and that should receive the POSTed data back to verify the transaction. The Thank you page (or success page) is called the return url - which is where your AutoReturn takes you. I have always been receiving the POST data to my IPN page no problem AND the the POST data to my return URL. However, just in the last few weeks, the POST data stopped coming to my success (return) URL but there's no explanation as to why it would suddenly stop. Now, I can only receive GET data at my success/return page by turning on PDT. But it's OK - I re-wrote my thank you page script to use the GET variables instead. PayPal must have change this without there being any notification - very annoyed with them.

Related

How to get last inserted ID and send again

How can I send the lastInsertId again to another php document?
Explanation why:
After someone sends a form (form.html) to a database (send.php) he will get an ID for that form. This ID I show in the send.php to the person via PDO:
<p>Your ID:<?php echo $dbh->lastInsertId(); ?></p>
At this confirmation page I want give the person the possibility to print the data from his form as an pdf. So I wrote:
<form action="print.php" method="POST">
<input type="hidden" name="ID" value="<=htmlspecialchars($_POST['lastInsertId']);?>"/>
<input type="submit" name="Print" value="Print" >
</form>
But I he doesn't send the lastInsertId -> I guess the problem is here:
value="<?=htmlspecialchars($_POST['lastInsertId']);?>"
Can you help me to solve that problem?
Your code should be like this:
<form action="print.php" method="POST">
<input type="hidden" name="ID" value="<?php echo $dbh->lastInsertId(); ?>"/>
<input type="submit" name="Print" value="Print" >
</form>
Not sure if it's the best way, but I once needed the last ID of a person who registered.
I did the following after inserting the info into the DB (My table has Auto Increment Primairy Key ID):
$lastId = mysqli_insert_id($con);
You can store the ID anywhere you want. (In the URL or cookie)
Hope this helps (:
Thank you very much! That helped.
Is their an easy way that after he press print (now gets with the ID all the data from the database to show it at the site print.php - that part all works) and NOW DIRECTLY asks to save as pdf?

Amazon s3 form post/upload redirecting to bucket after success on iOS safari/chrome only how to stop?

I have a web app that allows users to upload photos to an S3 bucket via HTML form. It works exactly as expected on all desktop browsers, which is to do nothing after a successful upload. However in iOS safari and iOS chrome, it redirects to the bucket. If I "Handoff" the page over to safari on my mac it is an xml response of the entire bucket, it appears.
Does anyone know why this would happen and how to fix it? Normally I can find something via google and the forums but I'm finding nothing!
We are not specifying "success action redirect" or "success action status" on our form.
Also, it works as expected in chrome on an android device.
We do not want any sort of redirect to occurs, we handle things on the client after clicking the submit/post button.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<div id ="mainContent">
<form action="https://s3.amazonaws.com/{!awsKeySet.Name}" method="post" enctype="multipart/form-data" id="uploadForm">
<input type="hidden" name="key" id="key" />
<input type="hidden" name="AWSAccessKeyId" value="{!awsKeySet.AWS_AccessKey_Id__c}" />
<input type="hidden" name="policy" value="{!policy}" />
<input type="hidden" name="signature" value="{!signedPolicy}" />
<input type="hidden" name="acl" value="{!acessType}" />
<input type="hidden" name="Content-Type" value="{!Content_Type}" />
<!--input type="hidden" name="success_action_status" value="201" /-->
<!--input type="hidden" name="success_action_redirect" value="{!ForRedirect}" /-->
<h4 class="fileToUpload">Select a File to Upload in AWS</h4><br />
<div class="row">
<input type="file" size="50" name="file" id="file" />
</div>
<div id="fileName"></div>
<div id="fileSize"></div>
<div id="fileType"></div>
<div class="row">
<input type="submit" value="Upload" id="btn_submit" />
</div>
<div id="progressNumber"></div>
</form>
</div>
<script>
$(document).ready(function () {
var _requestBucket;
$("#btn_submit").click(function(event){
//alert(1);
event.preventDefault();
var _file;
_file = $("#file").val().replace(/.+[\\\/]/, "");
console.log('_file '+ _file);
$("#key").val(_file);
$("#uploadForm").submit();
});
});
</script>
Thank you!
I wish someone could have shed more light on this but sadly, this is a bug in iOS webkit browsers. It appears to have been fixed in Android and Desktop. So, if anyone stumbles on this problem, included is the bugzilla link for it
Bugzilla link for Proper handling of HTTP 204
More detail : According to the amazon s3 docs
If the value is set to 200 or 204, Amazon S3 returns an empty document with a
200 or 204 status code.
If the value is set to 201, Amazon S3 returns an XML document with a
201 status code.
If the value is not set or if it is set to an invalid value, Amazon S3
returns an empty document with a 204 status code.
According to HTTP 1.1 -
10.2.5 204 No Content
The server has fulfilled the request but does not need to return an
entity-body, and might want to return updated metainformation. The
response MAY include new or updated metainformation in the form of
entity-headers, which if present SHOULD be associated with the
requested variant.
If the client is a user agent, it SHOULD NOT change its document view
from that which caused the request to be sent. This response is
primarily intended to allow input for actions to take place without
causing a change to the user agent's active document view, although
any new or updated metainformation SHOULD be applied to the document
currently in the user agent's active view.
The 204 response MUST NOT include a message-body, and thus is always
terminated by the first empty line after the header fields.
This is not happening in either webkit browsers for iOS, currently. Sadly. I cannot find a way around this, other for Apple to fix it!

PayPal purchase link deprecated?

For years I have used a link to Paypal to let users purchase from our site:
https://www.paypal.com/xclick/business=[OURMAILADDRESS]&item_name=[ProductName]&amount=26%2e80&shipping=0%2e00&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=it&bn=PP%2dBuyNowBF&charset=UTF%2d8'
The link stopped working about 2 weeks ago.
I cannot find any info on the net about it being deprecated.
Can anyone shine some light on this topic?
It looks like paypal has removed support for the paypal.com/xclick links that they previously recommended using (in the Website Payments Standard Checkout Integration Guide pdf from 2006).
Change your link to:
https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=...
For subscriptions, use:
https://www.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions&business=...
The link you provided is not showing a 404 not found error. It goes to paypal's splash screen page. From there a user can sign in. The url is redirected towards https://www.paypal.com/home. Looks like you're had a function there that isn't working any longer. I haven't seen that before, but do have a possible solution.
If you want to provide users a way to buy with paypal on your site, a common (and not hard) method is in the html with a paypal code such as code you've created on paypal's website (under "settings" you can create a button and paste the code into your website) or by hand creating an html Form with Input fields yourself.
You're sending the data that would be in the Input fields that would show up in the Form $_GET action to paypal in the url. Paypal doesn't talk about handling data that way. Maybe whatever was allowing that to work unofficially,no longer does.
There's a lots of examples of how to create a paypal button html code on SO. I can post some if you'd like. This site tells the input fields that your url data can be created with: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
Here's an example:
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="cmd" value="_cart"> <!-- I'm using cart, you want to stick the buy now option value in here. -->
<input type="hidden" name="business" value="yoru business signon email">
<input type="hidden" name="lc" value="EUR">
<input type="hidden" name="item_name" value="Whats bought">
<input type="hidden" name="amount" value="15.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="shopping_url" value="http://www.yours.com/OnlinePayButtons.php">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_SM.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_SM.gif" border="0" name="submit">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height=".8">
</form>
You have to pick out of the link to html variables, what inputs you need in the form. This gives a structure and idea of what it looks like.

Automatically search website field and get resulting URL

I want to automatically search a string at http://www.drugbank.ca/ and get the resulting URL (the search field is at the top of the page). The website can't be searched just by manipulating the URL. Is there a server-based way to do this? I want to create my own webpage with an input field and button to "Search DrugBank for X and get the URL".
Thanks.
You need to get the contents of:
http://www.drugbank.ca/search?query=searchstring
You can't do this with javascript it's not allowed by the browser to query sites of different domains (due to: http://en.wikipedia.org/wiki/Same_origin_policy).
I would do it with php and create a file like searchDrugBank.php:
<?php
$urlContent = file_get_contents('http://www.drugbank.ca/search?query=' . $_GET['q']);
// process $urlContent however you want
?>
And then you put on your site:
<form method="get" action="searchDrugBank.php">
<input type="text" name="q" />
<input type="submit" value="Search drugbank"/>
</form>
(Since you asked)
To find what URL I was gonna query I went to the site, and looked at the form that was submitted when I pressed search (look at the source, or in it's easy to do "inspect element" on for example the searchbox or searchbutton).
I find that the form is:
<form accept-charset="UTF-8" action="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
<strong>Search:</strong>
<input id="query" name="query" placeholder="Search DrugBank" size="30" type="search">
<input name="commit" type="submit" value="Search">
Help / Advanced
</form>
Which means that when you press search, exactly what happends is that you will do a GET request, since method="get" and get request means to ask for an url, and if parameters is required, they should be in the URL (http://en.wikipedia.org/wiki/Query_string#Web_forms).
The URL that will be queried is /search since action is action="/search" the rest of the url will then be built using provided parameters here it's just:
<input id="query" name="query" placeholder="Search DrugBank" size="30" type="search">
And there you can see that name of the parameter that should be provided to do a search, namely "query"!

How to send POST data, including JSON, from iOS app to webserver

Since I'm new to iOS developing, I need your help..
I need to send POST data from an iPad app to a webserver that will process the data.
In HTML it would be easily done by a form like this:
<form name="myform" action="myphpfile.php" method="post">
<input type="hidden" name="input1" value="1" />
<input type="hidden" name="input2" value="2" />
<input type="hidden" name="json" value="{"a":"1","b":"2"}" />
</form>
As you can see I have two "normal" input and one containing a json formatted array of values.
How can I send the data in my app and handle the json in the right way to avoid issues?
Thank you in advance for your help!
Read up on NSURLRequest. It exposes the HTTPMethod fields and HTTPBody. You'll want to encode your JSON as NSData and set it as the request body, your HTTPMethod will be "POST", obviously.

Resources