Useful Little PHP Script for WSO+ Sellers

2 replies
Hello.

I've been using WSO+ (WarriorPlus) recently to run a few WSOs, and I noticed that you can have the PayPal IPN data forwarded onto a URL. I realised I needed this data for another project I'll be working on in the new year, so I asked one of my developers to write a simple little script that accepted the data and then created an XML file for that transaction. (Later I'll be using that XML data in my other project.)

About 30 minutes ago as I write this, I'm really glad that I did. I had a customer come to me saying that they hadn't received any kind of notification email and would I send them their download page.

When I took a look I couldn't see any detail of the transaction in WSO+, and the payment had gone to an affiliate from the detail I received from the customer. Coincidentally I'd noticed this morning that the affiliates domain wasn't responding when I was trying to show a business partner something on that site. As the PayPal email address for the affiliate was on that domain, I think something went wrong in the process and that's why my customer didn't get their download link. I don't know for sure, but that seems a reasonable explanation to me for what's happened.

*phew*

Rather than jump on WSO+ support with this issue, I checked my XML files for the customers email address and found all the transaction data there.

I was then able to direct him to an order and download page for the product in my own ordering system.

Result!

If you use WSO+ and don't already have a script that takes the IPN forwarding data, then here's the simple script that will create an XML file per transaction for you.

To use it, just copy and paste the code below into notepad or similar text-only editor and save as paypal.php or some other PHP filename you're happy with - make sure it has a .php file extension.

Then:-

#1 - Create a directory on a domain you want to save the data.

#2 - Upload the script by FTP.

#3 - Point WSO+ to the URL of the script.

When your WSO starts making sales, then all the transaction data will get forwarded to the URL in #3 and it will start creating XML files for every transaction in the directory you plonked it in.

If for no other purpose than it's good for record keeping, then I think you'll find this is a useful little script.

What do I want in return? Well a "Thanks" would be nice, but that's about it. :rolleyes:

And... I'm afraid I can't really give you any individual support for it. If it works, it works and that's great. If it doesn't work for you, then I'm sorry to have wasted your time.

But... If there's enough interest and enough "Thanks", I *might* be tempted to add any little features you might ask for.

Have fun.


-Frank Haywood


Code:
<?php
$x = '';
foreach($_POST as $key => $value){
    $x .= "\t" . '<' . $key . '>' . $value . '</' . $key . '>' . "\n";
}

$content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Paypal>\n$x</Paypal>";

$email = $_POST['payer_email'];
$date = date('YmdHs');
$filename = str_replace('@', '+', $email . $date). '.xml';

$fp = fopen($filename, 'w') or die('can\'t open file');
fwrite($fp, $content);
fclose($fp);

?>
#php #script #sellers #wso

Trending Topics