Jump to content
Sign in to follow this  
dilesta

Canadapost error

Recommended Posts

Hi

Please help me I got error

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/dile3111/public_html/shop/admin/includes/languages/english/ship_canadapost.php on line 38

There was an error in processing--STEP--finish

 

line 38 define ('ENTRY_DECLARED_VALUE','Declared Value ('.DEFAULT_CURRENCY.'):');\

 

How fix the problem?

Share this post


Link to post
Share on other sites
How fix the problem?

PHP actually tells you what the problem is: the backslash in that line: ;\

Remove it.

Share this post


Link to post
Share on other sites
PHP actually tells you what the problem is: the backslash in that line: ;\

Remove it.

Thank You is now ok on line 38

but now I got another error on line 39

line 38define ('ENTRY_DECLARED_VALUE','Declared Value ('.DEFAULT_CURRENCY.'):')
line 39define ('ENTRY_TOTAL_ITEM_WEIGHT', 'Total Items Weight:');

Share this post


Link to post
Share on other sites
Thank You is now ok on line 38

but now I got another error on line 39

[codeb]line 38define ('ENTRY_DECLARED_VALUE','Declared Value ('.DEFAULT_CURRENCY.'):')
line 39define ('ENTRY_TOTAL_ITEM_WEIGHT', 'Total Items Weight:');[/code]

A backslash is this character: \

A semi-colon is this character: ;

A semi-color followed by a backslash is this: ;\

Did I say something about removing a semi-colon?

Edited by Jan Zonjee

Share this post


Link to post
Share on other sites

That's what happens when you try to be extra helpful and put

 

;/

 

Remove it

 

So they did, rather than just remove the offending /.

 

Don't you just hate it.

 

Happy New Year and thanks for all your excellent posts.

 

G


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites
That's what happens when you try to be extra helpful and put

 

;/

 

Remove it

 

So they did, rather than just remove the offending /.

 

Don't you just hate it.

 

Happy New Year and thanks for all your excellent posts.

 

G

 

Thanks for helping please look at the code

<?php
define ('LABEL_FILE',DIR_WS_IMAGES.'canadapost/%s.pdf');
define ('PROCESSING_ERROR','There was an error in processing');
define ('PROCESSING_COMPLETE','Completed.');
define ('STEP_DELIMITER','--STEP--');
define ('STEP_KILL_KEY','finish');

// AJAX RESPONSES
define ('SC_GENERAL_ERROR', 'Failed check in ' . __FILE__ . ' at line ' . __LINE__  . '. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.');

define ('INIT', 'Initialized.');
define ('LOGGEDIN', 'Logged In.');
define ('APP_START', 'Started shipping application.');
define ('ADDRESS', 'Entered address.');
define ('SHIPPING', 'Selected shipping method.');
define ('CUSTOMS', 'Filled out customs information.');
define ('NO_CUSTOMS', 'Customts information not required. Skipped.');
define ('PAYMENT', 'Payment processed.');
define ('LABEL', 'Label received and saved.');
define ('SUCCESS', 'Success!');
define ('NO_TRACKING', 'Couldn\'t get tracking number');
define ('NO_TRACKING_AVAILABLE', 'Tracking number is not available.');
define ('TRACKING', 'Tracking number is %s.');
define ('CUSTOMER_NOTIFIED', 'Customer has been notified via email.');
// FORM FIELDS
define ('HEADING_TITLE','Canada Post Automated Labels');

define ('HEADING_REQUIRED_FIELDS','Required Fields');
define ('HEADING_OPTIONAL_FIELDS','Optional Fields');
define ('HEADING_PROGRESS_INDICATOR','Progress Indicator');
define ('ENTRY_RECIPIENT', 'Recipient Information:');
define ('ENTRY_SHIPPING_METHOD','Shipping Method:');
         define ('ENTRY_SERVICE_TYPE','Type of Service:');
         define ('ENTRY_PACKAGE_DIMENSIONS','Your Package Dimensions (cm):');
         define ('ENTRY_EXPORT_REASON', 'Reason for Export:');
         define ('ENTRY_CUSTOMIZE','Customize Value and Weight:');
         define ('ENTRY_CUSTOMS','Description for Customs:');
         define ('ENTRY_DECLARED_VALUE','Declared Value ('.DEFAULT_CURRENCY.'):');
line 39define ('ENTRY_TOTAL_ITEM_WEIGHT', 'Total Items Weight:');
[color="#FFFF00"]line 40define ('ENTRY_INVOICE', 'Invoice #:');[/color]
         define ('ENTRY_REFERENCE','Reference #:');
         define ('ENTRY_SIGNATURE_REQUIRED', 'Signature Required:');
         define ('ENTRY_ITEM_LIST','Items:');
         define ('ENTRY_NOTIFY_RECIPIENT_DELIVERY','Notify For Delivery:');
        define ('ENTRY_NOTIFY_RECIPIENT_SHIPMENT','Notify For Shipment:');
define ('ENTRY_INSURANCE','Insurance Coverage:');
define ('ENTRY_DISPLAY_INSURANCE','Display Insurance on Package');
define ('ENTRY_SHIPPING_COMMENTS','Shipping Comments:');

define ('TEXT_WEIGHT_WARNING','Change this to the Total Package Weight.');
define ('TEXT_INSURANCE','(100,200, .. 1000)');
define ('TEXT_MAX_CHARACTERS','(Maximum characters: (150)');
define ('MAX_CHAR_BEGIN','You have ');
define ('MAX_CHAR_END',' characters left.');

define('IMAGE_SUBMIT','Submit');

define('ORDER_HISTORY_SHIPPED','Order shipped.');
define('ORDER_HISTORY_SHIPPED_TRACK','Scheduled shipment, tracking number ');
define('EMAIL_SEPARATOR', '------------------------------------------------------');
define('EMAIL_TEXT_SUBJECT', 'Order Update');
define('EMAIL_TEXT_ORDER_NUMBER', 'Order Number:');
define('EMAIL_TEXT_INVOICE_URL', 'Detailed Invoice:');
define('EMAIL_TEXT_DATE_ORDERED', 'Date Ordered:');
define('EMAIL_TEXT_STATUS_UPDATE', 'Your order status is ' . '%s' . "<br><br>" . 'Please reply to this email if you have any questions.' . "\n");
define('EMAIL_TEXT_COMMENTS_UPDATE', 'Comments: ' . "%s\n");
define('EMAIL_TEXT_TRACKING_NUMBER', 'You can track your packages by clicking the link below.');
// UPDATE CANADA POST TRACKING URL	
define('URL_TO_TRACK1', 'https://em.canadapost.ca/emo/basicPin.do?trackingCode=PIN&action=query&language=en&scloc=segment&trackingId=');

/************************************************************************
     ARE THESE USED???                                              
************************************************************************/
define('ORDER_HISTORY_CANCELLED','Cancelled shipment');
define('NO_ORDER_NUMBER_ERROR','No order number specified!');
define('SHIPMENT_REQUEST_DATA','Shipment request data, package number ');
define('MANIFEST_DATA','Manifest data, package number ');
define('RUNNING_IN_DEBUG','Running in debug mode, no ship request made');
define('ERROR_NO_ORDER_SPECIFIED','ERROR: There is no order specified!');
define('ORDER_NUMBER','Order number ');
define('COULD_NOT_DELETE_ENTRIES','Could not delete manifest entries.');
define('ERROR','ERROR: ');
define('ENTER_PACKAGE_WEIGHT','You must enter a package weight.');
define('ENTER_NUMBER_PACKAGES','You must enter the number of packages.');
/***********************************************************************/
?>

 

I got another error when i fix one go to another what is wrong?

Parse error: syntax error, unexpected T_STRING in /home/dile3111/public_html/shop/admin/includes/languages/english/ship_canadapost.php on line 40

Share this post


Link to post
Share on other sites
I got another error when i fix one go to another what is wrong?

Parse error: syntax error, unexpected T_STRING in /home/dile3111/public_html/shop/admin/includes/languages/english/ship_canadapost.php on line 40

Looks fine to me. I did get errors like that when I had utf-8 spaces in PHP files (e.g. when copied and pasted code from websites). I don't know what text editor you use but perhaps you should try one in which you can save text as iso-8859-1.

Share this post


Link to post
Share on other sites
Looks fine to me. I did get errors like that when I had utf-8 spaces in PHP files (e.g. when copied and pasted code from websites). I don't know what text editor you use but perhaps you should try one in which you can save text as iso-8859-1.

I copy and paste in PHP files witch text as iso-8859-1 now another error

Step 1. Initialized.

Step 2. Error: Failed check in /home/dile3111/public_html/shop/admin/includes/languages/english/ship_canadapost.php at line 9. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

 

thanks again for help.

Share this post


Link to post
Share on other sites

Step 2 is where you are logged in. Make sure you put the correct user details at the top of ship_canadapost.php.

 

If that doesn't help, you can set $debug = 1; at the top. This will dump all the data returned from Canada Post when you ship.

Share this post


Link to post
Share on other sites
I copy and paste in PHP files witch text as iso-8859-1 now another error

Step 1. Initialized.

Step 2. Error: Failed check in /home/dile3111/public_html/shop/admin/includes/languages/english/ship_canadapost.php at line 9. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

 

thanks again for help.

 

I'm getting the same error message and can't seem to find where things are going wrong.

 

Any help would be appreciated

Share this post


Link to post
Share on other sites
I'm getting the same error message and can't seem to find where things are going wrong.

 

Any help would be appreciated

Have you tried changed the corresponding line to $debug=1; at the top of the ship_canadapost.php file? That will give all the output from Canada Post server.

Share this post


Link to post
Share on other sites
Have you tried changed the corresponding line to $debug=1; at the top of the ship_canadapost.php file? That will give all the output from Canada Post server.

 

Ok I got the dump but I don't know what I'm looking for in the file.

Edited by oyb

Share this post


Link to post
Share on other sites
Ok I got the dump but I don't know what I'm looking for in the file.

You should look for any error message in the last part of the dump. Or remove your user name and password from the dump and paste it here (make sure to use the code tag!!!)

Share this post


Link to post
Share on other sites

Duh, that's why I said to use code tag :P

 

OK, it looks like the cookie file might not be written.

 

Canada Post Automatic Labels 1.2.1 writes it to admin/temp/ folder. Check whether cp_cookies file is there. If not, make that folder writeable.

 

Canada Post Automated Labels 2.0 and Canada Post Shipping Module 4.0 defines the location for the cookie file in ship_canadapost_ajax.php file. Make sure the path is correct and writeable!

Share this post


Link to post
Share on other sites
Duh, that's why I said to use code tag :P

 

OK, it looks like the cookie file might not be written.

 

Canada Post Automatic Labels 1.2.1 writes it to admin/temp/ folder. Check whether cp_cookies file is there. If not, make that folder writeable.

 

Canada Post Automated Labels 2.0 and Canada Post Shipping Module 4.0 defines the location for the cookie file in ship_canadapost_ajax.php file. Make sure the path is correct and writeable!

 

I did have the folder under admin/temp and it was set with 777 as permissions, so I changed the path to be that in the ajax file...

Now I get to step 3 and then it stops after the login;

Progress Indicator

Step 1. Initialized.

Step 2. Logged In.

Step 3. Error: Failed check in /home/oybc9351/public_html/shop/admin/includes/languages/english/ship_canadapost.php at line 9. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

Edited by oyb

Share this post


Link to post
Share on other sites

OK, please post the dump again inside [ code ] [/ code ] tags. Step 3 is start of the shipping application.

Edited by natrium42

Share this post


Link to post
Share on other sites
OK, please post the dump again inside [ code ] [/ code ] tags. Step 3 is start of the shipping application.

Step 1. Initialized.
[url="https://sso-cal.canadapost-postescanada.ca/sso/login/redirect"]https://sso-cal.canadapost-postescanada.ca/.../login/redirect[/url]

HTTP/1.1 200 OK
Date: Tue, 27 Jan 2009 19:25:54 GMT
Content-Length: 706
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache, no-store

<html><body>
<form name=Login action="/sso/login.jsp?~language=EN" method=POST>
<input type=hidden name="locale" value="en_CA">
<input type=hidden name="~language" value="EN">
<input type=hidden name="formId" value="110">
<input type=hidden name="SSO_CUSTOMER_NUMBER" value="*******,">
<input type=hidden name="SSO_VERSION_MAJOR" value="3">
<input type=hidden name="SSO_VERSION_MINOR" value="0">
<input type=hidden name="SSO_VERSION_MICRO" value="0">
<input type=hidden name="SSO_VERSION" value="3.0.0">
<input type=hidden name="SSO_PASSWORD" value="******">
<input type="hidden" name="APP_ID" value="B2B"></form>
<script>document.forms[0].submit();</script>
</body></html>

Step 2. Logged In.
[url="https://sso-cal.canadapost-postescanada.ca"]https://sso-cal.canadapost-postescanada.ca[/url]

HTTP/1.1 404 Not Found
Date: Tue, 27 Jan 2009 19:25:55 GMT
Content-Length: 1214
Content-Type: text/html
Connection: close

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 404--Not Found</TITLE>
<META NAME="GENERATOR" CONTENT="WebLogic Server">
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 404--Not Found</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
</FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.5 404 Not Found</H4>
</FONT><P><FONT FACE="Courier New">The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.</p><p>If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.</FONT></P>
</FONT></TD></TR>
</TABLE>

</BODY>
</HTML>


Step 3. Error: Failed check in /home/oybc9351/public_html/shop/admin/includes/languages/english/ship_canadapost.php at line 10. This most likely means that Canada Post has changed their user interface. You need to update your Canada Post Automatic Shipping Labels module.

 

By the looks of it, it seems like the https://sso-cal.canadapost-postescanada.ca is an invalid address, as if you type it in it will give you an error message just in your browser... is that not what it should be in the ajax file?

Share this post


Link to post
Share on other sites

It looks like there is some problem relaying $response between steps of ship_canadapost_ajax.php. In this case, $response from step 2 doesn't seem to be available in step 3. So it doesn't assemble the correct URL, which should be "https://sso-cal.canadapost-postescanada.ca/sso/login.jsp?~language=EN"

 

So first, make sure that you have cookies enabled in your browser. The code is using sessions, so maybe it's broken if you have cookies disabled. I don't have this "2.0" version installed, so I cannot easily test a solution for you.

 

You can also install my original contribution "Canada Post Automatic Labels 1.2.1" instead. I don't really see any advantages of the 2.0 version. It uses AJAX, sure, but there doesn't seem to be a point if you still have to wait for the process to finish before you can do something else when shipping.

Edited by natrium42

Share this post


Link to post
Share on other sites
It looks like there is some problem relaying $response between steps of ship_canadapost_ajax.php. In this case, $response from step 2 doesn't seem to be available in step 3. So it doesn't assemble the correct URL, which should be "https://sso-cal.canadapost-postescanada.ca/sso/login.jsp?~language=EN"

 

So first, make sure that you have cookies enabled in your browser. The code is using sessions, so maybe it's broken if you have cookies disabled. I don't have this "2.0" version installed, so I cannot easily test a solution for you.

 

You can also install my original contribution "Canada Post Automatic Labels 1.2.1" instead. I don't really see any advantages of the 2.0 version. It uses AJAX, sure, but there doesn't seem to be a point if you still have to wait for the process to finish before you can do something else when shipping.

Sorry for cross posting... I did check for browser cookies in both FireFox and IE and neither work.

 

The version 2 of the contribution has additional features (input boxes) which I like.

 

I really appreciate your help btw

Share this post


Link to post
Share on other sites
Sorry for cross posting... I did check for browser cookies in both FireFox and IE and neither work.

 

The version 2 of the contribution has additional features (input boxes) which I like.

 

I really appreciate your help btw

 

So I installed your version 1.2 and it works, I would like to be able to a comments field to send more information than just the tracking number to my clients.

 

Thanks for you help :)

Share this post


Link to post
Share on other sites
So I installed your version 1.2 and it works, I would like to be able to a comments field to send more information than just the tracking number to my clients.

Hmm, I should probably add that feature to the contribution. I also added a way to modify the address before submission (you also get two address lines), just need to put it together and update the public version. Any other suggestions?

 

As for the 2.0 version, maybe you could PM insaini about it? He might be able to help you solve this problem.

Edited by natrium42

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×