Originally posted by xoggoth
View Post
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Reply to: PHP email string problem
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "PHP email string problem"
Collapse
-
Hey! urlencode the sent string, urldecode the received string works! Any sane person would imagine the string would end up as it was!
Anyway cheers Nick (again). Definitely going for a drink now.
Leave a comment:
-
In the callback, try
PHP Code:$description = urldecode($_POST['description']);
Leave a comment:
-
Cheers again. urlencode does ensure sending of the full text but this is a plain text email, so now the customer gets:
1+Plant+Guides+Pack+%26pound%3B11.50+each%2C+total ++%26pound%3B11.50+%0D% etc
The way a WP callback normally works is pretty simple, you post a value to Worldpay eg:
<form name="order" action="https://secure.worldpay.com/wcc/purchase" method=post>
<input type="text" name="name">
etc
and then process their callback exactly as if it had been submitted directly from your form eg:
<?php
$name = $_POST['name']
I had no problems at all creating variables with my jscript cart but having trouble doing what appears to be exactly the same darn thing in PHP!
Anyway, its Friday, off to the village club. Ta very much all. You are dismissed for now, will rehire you (for unpaid work experience) on Monday.
Leave a comment:
-
Originally posted by mudskipper View PostLooks like different languages do different things...
http - URL encoding the space character: + or %20? - Stack Overflow
Leave a comment:
-
Looks like different languages do different things...
http - URL encoding the space character: + or %20? - Stack Overflow
Leave a comment:
-
Originally posted by mudskipper View PostFrom: http://www.worldpay.com/support/kb/bg/pdf/rhtml.pdf
Is this the mechanism you're using? Looks like you need + for space as doodab suggested. (I always thought URLEncode stuck in %20?)
PHP Code:<?php
$foo = array("foo", "bar bar");
$bar = 1;
echo urlencode("blah $foo[$bar]\n");
?>
Code:blah+bar+bar%0A
Leave a comment:
-
From: http://www.worldpay.com/support/kb/bg/pdf/rhtml.pdf
URL Order Details String
You do not have to use an HTML form to create and submit order details, or to integrate - you
can also submit order details in a URL string. For example, you can integrate with this single
URL string:
https:// secure-test.worldpay.com/wcc/purchase?instId=123456&cartId=WorldPay+Test&amount =40.00¤cy=GBP&desc=WorldPay+Test&testMode=10 0
As with form-based submissions, the URL order details string must contain the four
mandatory parameters, as shown in the example.
(Edit: I added the space after the // to stop it from being turned into a link...)Last edited by mudskipper; 15 November 2013, 18:25.
Leave a comment:
-
Is it submitted as a URL? Do you need to encode the spaces as + signs?
Leave a comment:
-
Originally posted by xoggoth View PostTa for comments but that ain't it. I deliberately put the 1st item in quotes to fix the same problem with my own email code and it did, just not working with the Worldpay callback email. Really don't need the . as just put vars in the string but that has the same problem, this also stops at first space and just shows 3
$description .= "$num[$i] $descs[$i] $fprice[$i] each, total = $fcost[$i] \r\n";
If I put:
$description .= "$num[$i]xxx$descs[$I]yyy$fprice[$i] each, total = $fcost[$i] \r\n";
I get xxx1yyyBird, it stops at the next space instead.
PHP Code:$description = urlencode($description);
As it happens I spent May to September this year contracting in the same building as WorldPay on Cambridge Science Park; if I was still there I could just stop people in reception and ask them until I found somebody who knew. But I'm not there any more, so I can't. Ho hum
Leave a comment:
-
Ta, but tried that as said in previous. Only way I can get it through WP callback is with all spaces replaced by #, newlines by ## and change 'em all back when it reaches my code. Messy.
Leave a comment:
-
Originally posted by Bunk View PostI'm no expert in PHP but haven't you got double quotes around the first variable?
Shouldn't it be:
PHP Code:$description .= $num[$i]." ".$descs[$i]." ".$fprice[$i]." each, total = ".$fcost[$i]." \r\n";
However this means it's unnecessary to do the concatenations. The following should work, and is easier to read:
PHP Code:$description .= "$num[$i] $descs[$i] $fprice[$i] each, total = $fcost[$i] \r\n";
Leave a comment:
-
Ta for comments but that ain't it. I deliberately put the 1st item in quotes to fix the same problem with my own email code and it did, just not working with the Worldpay callback email. Really don't need the . as just put vars in the string but that has the same problem, this also stops at first space and just shows 3
$description .= "$num[$i] $descs[$i] $fprice[$i] each, total = $fcost[$i] \r\n";
If I put:
$description .= "$num[$i]xxx$descs[$I]yyy$fprice[$i] each, total = $fcost[$i] \r\n";
I get xxx1yyyBird, it stops at the next space instead.
Leave a comment:
-
Originally posted by Bunk View PostI'm no expert in PHP but haven't you got double quotes around the first variable?
Shouldn't it be:
PHP Code:$description .= $num[$i]." ".$descs[$i]." ".$fprice[$i]." each, total = ".$fcost[$i]." \r\n";
Haven't done php for ages.
Leave a comment:
-
I'm no expert in PHP but haven't you got double quotes around the first variable?
Shouldn't it be:
PHP Code:$description .= $num[$i]." ".$descs[$i]." ".$fprice[$i]." each, total = ".$fcost[$i]." \r\n";
Leave a comment:
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- An IR35 case law look back: contractor must-knows for 2025-26 Today 09:30
- A contractor’s Autumn Budget financial review Yesterday 10:59
- Why limited company working could be back in vogue in 2025 Dec 16 09:45
- Expert Accounting for Contractors: Trusted by thousands Dec 12 14:47
- Finish the song lyric Dec 12 12:05
- A quick read of the taxman’s Spotlight 67 may not be enough Dec 12 09:27
- Contractor MVL Solution from SFP Dec 11 12:53
- Gary Lineker and HMRC broker IR35 settlement on the hush Dec 11 09:10
- IT contractor jobs market sinks to four-year low in November Dec 10 09:30
- Joke of the Day Dec 9 14:57
Leave a comment: