473,766 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_RFC21 04HMAC ($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 2228
mb****@gmail.co m 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_RFC21 04HMAC ($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
2001
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 verified all closing braces etc. and can't understand why the line in question is generating a T_STRING error Here is the code: //----------------------------------------------------- //THIS IS LINE 44 fuction dbConnect($aDbTable,$SQLstat)
2
2887
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 process_card($card_details) { // connect to payment gateway or // use gpg to encrypt and mail or // store in DB if you really want to
0
2487
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 control. The Custom OCX is not used for visual purposes, but has some functionality that we require (hence hosting an OCX in a DLL). Everything worked fine until we installed the latest service pack for each respective windows operating system:...
5
13173
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') VALUES ('$_POST', '$_POST', '$_POST') mysql_query($sql)"; When I view the code in Internet Explorer I get the following error message: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or...
36
8010
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 shortcomings will soon become apparent. I am developing an estimating construction system, using PHP5 and MySQL 5.0.24a with Ubuntu. I have a main "projects" file, and 2 detail files, one for piping and one for equipment. Each of these files will have...
13
30569
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 can't find that on php sites. Any suggestion is appreciated. Anne Bos
11
2936
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: attachment; header("Pragma: no-cache"); header("Expires; 0"); print "$header\n$data";
0
1806
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 /home/allrail/public_html/header.php:40) in /home/ allrail/public_html/header.php on line 39 as well as this: Fatal error: Cannot redeclare maketr() (previously declared in /home/ allrail/public_html/templates/menu.php.html:24) in /home/allrail/...
2
5246
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
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10008
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.