473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

T_STRING error with pack function

I'm getting the T_STRING error ("Parse error: syntax error, unexpected
T_STRING in alexa5.php on line 26") when using the pack function:

function calculate_RFC2104HMAC ($data, $key) {
return base64_encode (
pack ( "H*" , sha1((str_pad($key, 64 , chr ( 0 x00))
( str_repeat ( chr ( 0 x5c), 64 ))) .
pack ( "H*" , sha1((str_pad($key, 64 , chr ( 0 x00))
( str_repeat ( chr ( 0 x36), 64 ))) . $data))))

);

}

"Line 26" refers to line 3 above: "pack ("H....."

I have no experience with pack, but the pack manual doesn't give me any
clues as to the problem. I've commented out the pack stuff and replaced
it with a print command to ensure it was this and not the previous line
that is causing the problem.

I've been working on this for several hours and have asked the best PHP
friends I have, and have gotten no leads. Any hints from you guys would
do wonders for my morale.

You can see the full code here
http://developer.amazonwebservices.c...=6825&start=13

thank you, thank you, thank you

matt

Apr 13 '06 #1
2 2212
mb****@gmail.com wrote:
I'm getting the T_STRING error ("Parse error: syntax error, unexpected
T_STRING in alexa5.php on line 26") when using the pack function:

function calculate_RFC2104HMAC ($data, $key) {
return base64_encode (
pack ( "H*" , sha1((str_pad($key, 64 , chr ( 0 x00))
( str_repeat ( chr ( 0 x5c), 64 ))) .
pack ( "H*" , sha1((str_pad($key, 64 , chr ( 0 x00))
( str_repeat ( chr ( 0 x36), 64 ))) . $data))))

);

}

"Line 26" refers to line 3 above: "pack ("H....."

I have no experience with pack, but the pack manual doesn't give me any
clues as to the problem. I've commented out the pack stuff and replaced
it with a print command to ensure it was this and not the previous line
that is causing the problem.


It's nothing to do with the specific function - a parse error means
that your basic PHP syntax is incorrect. Check your opening/closing
brackets and comma separators on that line...

--
Oli

Apr 13 '06 #2
Right; I'd been poring over it trying to figure out where the error
was. I found another copy of the code, and it's working now. I don't
see any difference; maybe I had invisible characters in there or
something.

thanks for reading

Apr 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul | last post by:
Hello, Thanks in advance for your help, I have 3 pages generating the same exact error on the same section of each page and I can't see the problem - hoping a second set of eyes can help. I...
2
by: Salim | last post by:
Hi people, keep getting this errorParse error: parse error, unexpected T_STRING in order_fns.php line 91. the code is below for the file and I've indicated line 91 <?php function...
0
by: MarkD | last post by:
I have an ASP.NET (VB.NET) application that calls all VB6 COM DLL via Interop. The DLL uses functionality contained in a Custom OCX Control (Also VB6) that in turn contains a standard TreeView...
5
by: Anna MZ | last post by:
I am new to php and have written the following mysql code to enter the details of a new user in the admin subdomain of my website: $sql = "INSERT INTO 'users' ('userid', 'username', 'upassword')...
36
by: rhys | last post by:
My Gurus and Angels -- Please pardon this old-school programmer, only recently enlightened to open-source, having been trapped in the convenience of proprietary lingos for way too long. My...
13
by: Anne Bos | last post by:
After uploading a php file I got back the error message 'unexpected T_STRING on line 1'. Line 1 is <?php session_start() ?>. The servers php version is 5.2.1. By the way, what is a T_STRING. I...
11
by: JRough | last post by:
I'm trying to use output buffering to cheat so i can print to excel which is called later than this header(). header("Content-type: application/xmsdownload"); header("Content-Disposition:...
0
by: JRough | last post by:
On Sep 26, 3:23 pm, Captain Paralytic <paul_laut...@yahoo.comwrote: without the exit I get this again: Warning: Cannot modify header information - headers already sent by (output started at...
2
hsriat
by: hsriat | last post by:
<?php //Content_Page class class Content_Page { private $title = array(); private $content = array(); private $js = array(); function __construct($title, $content, $js) {
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.