473,387 Members | 1,575 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,387 software developers and data experts.

wierd error

I have this very simple PHP script:

#!/usr/local/bin/php -q

<?php
$post="From: \"Burek\" <bu***@burek.hr>\\nSubject: foobar\\nNewsgroups:
hr.test\\n\\nNesto, nesto.';

$command="echo -ne \"mode reader\\npost\\n" . $post . "\\n.\\nquit\\n\"
| nc news.carnet.hr 119\n";
echo $command;
exec($command);
?>

And it fails to execute:
PHP Parse error: parse error in /home/users/n/nick/bin/postFAQ.php on
line 6

I have dissected the script and found that when I write it this way:
$command=
"echo"
. " -ne \"mode reader\\npost\\n" . $post . "\\n.\\nquit\\n\" | nc
news.carnet.hr 119\n";
Then the error is on the line where "echo" is. Now, what am I missing?

--
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"
Jun 5 '06 #1
7 1197
Syl

Nikola Skoric wrote:
I have this very simple PHP script:

#!/usr/local/bin/php -q

<?php
$post="From: \"Burek\" <bu***@burek.hr>\\nSubject: foobar\\nNewsgroups:
hr.test\\n\\nNesto, nesto.';

$command="echo -ne \"mode reader\\npost\\n" . $post . "\\n.\\nquit\\n\"
| nc news.carnet.hr 119\n";
echo $command;
exec($command);
?>

And it fails to execute:
PHP Parse error: parse error in /home/users/n/nick/bin/postFAQ.php on
line 6

I have dissected the script and found that when I write it this way:
$command=
"echo"
. " -ne \"mode reader\\npost\\n" . $post . "\\n.\\nquit\\n\" | nc
news.carnet.hr 119\n";
Then the error is on the line where "echo" is. Now, what am I missing?


try this :

$command="echo -ne 'mode reader\\npost\\n' . $post . '\\n\\nquit\\n\'
| nc news.carnet.hr 119\n";
also - why do you the dot operator here :
"\\n.\\nquit\\n\"

Jun 6 '06 #2
Dana 5 Jun 2006 19:14:07 -0700,
Syl <da**********@gmail.com> kaze:
try this :

$command="echo -ne 'mode reader\\npost\\n' . $post . '\\n\\nquit\\n\'
| nc news.carnet.hr 119\n";
Well, that won't work. The code I put in $comand variable is not PHP code
but bash code.
also - why do you the dot operator here :
"\\n.\\nquit\\n\"


That's not dot operator but NNTP command signalising end of article...

--
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"
Jun 6 '06 #3
Nikola Skoric wrote:
I have this very simple PHP script:

#!/usr/local/bin/php -q

<?php
$post="From: \"Burek\" <bu***@burek.hr>\\nSubject: foobar\\nNewsgroups:
hr.test\\n\\nNesto, nesto.';

$command="echo -ne \"mode reader\\npost\\n" . $post . "\\n.\\nquit\\n\"
| nc news.carnet.hr 119\n";
echo $command;
exec($command);
?>

And it fails to execute:
PHP Parse error: parse error in /home/users/n/nick/bin/postFAQ.php on
line 6

I have dissected the script and found that when I write it this way:
$command=
"echo"
. " -ne \"mode reader\\npost\\n" . $post . "\\n.\\nquit\\n\" | nc
news.carnet.hr 119\n";
Then the error is on the line where "echo" is. Now, what am I missing?


Nikola,

Check your file to see if you possibly have mismatched double quotes earlier in
your file (or in a file which includes this one).

Normally when I see this it means I've screwed up and had mismatched quotes
earlier in the file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 6 '06 #4
Dana Tue, 06 Jun 2006 07:02:33 -0400,
Jerry Stuckle <js*******@attglobal.net> kaze:
Check your file to see if you possibly have mismatched double quotes earlier in
your file (or in a file which includes this one).

Normally when I see this it means I've screwed up and had mismatched quotes
earlier in the file.


Nope, I pasted the whole script, and the script is executed from command
line, it is not included...

--
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"
Jun 6 '06 #5
Nikola Skoric wrote:
I have this very simple PHP script:

#!/usr/local/bin/php -q

<?php
$post="From: \"Burek\" <bu***@burek.hr>\\nSubject: foobar\\nNewsgroups:
hr.test\\n\\nNesto, nesto.';

$command="echo -ne \"mode reader\\npost\\n" . $post . "\\n.\\nquit\\n\"
| nc news.carnet.hr 119\n";
echo $command;
exec($command);
?>

And it fails to execute:
PHP Parse error: parse error in /home/users/n/nick/bin/postFAQ.php on
line 6

I have dissected the script and found that when I write it this way:
$command=
"echo"
. " -ne \"mode reader\\npost\\n" . $post . "\\n.\\nquit\\n\" | nc
news.carnet.hr 119\n";
Then the error is on the line where "echo" is. Now, what am I missing?


OK, check your first line. You start the string with a " but end it with a '.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 6 '06 #6
In article <k6******************************@comcast.com>,
js*******@attglobal.net says...
OK, check your first line. You start the string with a " but end it with a '.


I refuse to belive this... but, yes, you are right. A week of debugging
one single quote. Hope it won't happen again. Thanks a bunch.

--
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"
Jun 7 '06 #7
Rik
Nikola Skoric wrote:
In article <k6******************************@comcast.com>,
js*******@attglobal.net says...
OK, check your first line. You start the string with a " but end it
with a '.


I refuse to belive this... but, yes, you are right. A week of
debugging
one single quote. Hope it won't happen again. Thanks a bunch.


Many editors with syntax highlighting could have shown you this in a
heartbeat. Which editor do you use?

Grtz,
--
Rik Wasmus
Jun 7 '06 #8

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

Similar topics

3
by: vool | last post by:
Hi all, I've got a really wierd problem here. When I access a web page that adds information to a database on a PC running XP Pro it works as it should. When I access the same page from a...
0
by: Niranjan | last post by:
Access XP Windows XP This code has been working for over 5 years with no problems and all of a sudden I am running into these wierd problems. I have this code to delete a record....
1
by: paul reed | last post by:
Hello, I am having some weird behavior between two machines...one which is running the 1.1 framework and one which is running 1.0. After opening a child form from a parent...I update the...
7
by: Shane Bishop | last post by:
I've been fighting with the Page_Load event firing twice. I looked through this user group and saw several other people having similar problems. There were various reasons for it:...
1
by: Shaman | last post by:
ok i got this wierd problem which took me 4 hours already and im still stuck :/ anybody know what is wrong here ------Code----- Public Class guildnod Private node() As TreeNod Private tot As...
1
by: YourAverageJoe | last post by:
To whom it may concern: I'm running Fedora Core 4 on a rather low-spec system (considered good cirkabout '99), this one program I'm trying to run is dependant on Python, so I downloaded the RPM,...
3
by: Tom | last post by:
We are experiencing some wierd debugging behavior. What happens is that, during debugging with VS 2003, the debugger seems to 'skip' statements that are associated with database operations. For...
8
by: John Nagle | last post by:
Here's a wierd problem: I have a little test case for M2Crypto, which just opens up SSL connections to web servers and reads their certificates. This works fine. But if I execute ...
5
by: desktop | last post by:
I am confused about the use of the template parameter "E" in the below class. Since when is it allowed to use these parameters like "E(1)" and what does it mean (where can I read more about this...
1
by: samneil | last post by:
I have 1 Database( MS Access) with 9 tables and 6 queries, Now I'm trying to view my 2 different tables on my VB6.0 using 2 Datagrids and 2"adodc".... here are the names of my two tables:...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.