| | |
Parse error: syntax error, unexpected T_STRING
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2008
Posts: 39
Reputation:
Solved Threads: 0
I am getting error at the second line of the code, what is the problem
$content = '<' . '?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?' . '>'; $content .= "<entry xmlns='http://purl.org/atom/ns#'>"; $content .= "<title mode='escaped' type='text/plain'>".$title."</title>"; $content .= "<issued>".$issued."</issued>" $content .= "<generator url='http://www.yoursitesurlhere.com'>client's name</generator>"; $content .= "<content type='application/xhtml+xml'>"; $content .= "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>"; $content .= "</content>"; $content .= "</entry>";
•
•
•
•
I am getting error at the second line of the code, what is the problem![]()
php Syntax (Toggle Plain Text)
$content = '<' . '?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?' . '>'; $content .= "<entry xmlns='http://purl.org/atom/ns#'>"; $content .= "<title mode='escaped' type='text/plain'>".$title."</title>"; $content .= "<issued>".$issued."</issued>" $content .= "<generator url='http://www.yoursitesurlhere.com'>client's name</generator>"; $content .= "<content type='application/xhtml+xml'>"; $content .= "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>"; $content .= "</content>"; $content .= "</entry>";
$content .= "code";
$content .= "code";
$content .= "code";
Creates one logical line,
missing semi-colon after </issued>" creates a second line, and a syntax error
Last edited by almostbob; Jan 11th, 2009 at 11:56 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Mar 2008
Posts: 39
Reputation:
Solved Threads: 0
Ok, I use this;
But now it gives error at the first line of this code...
PHP Syntax (Toggle Plain Text)
$content = '<' . '?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?' . '>'; $content .= "<entry xmlns='http://purl.org/atom/ns#'>"; $content .= "<title mode='escaped' type='text/plain'>".$title."</title>"; $content .= "<issued>".$issued."</issued>"; $content .= "<generator url='http://www.yoursitesurlhere.com'>client's name</generator>"; $content .= "<content type='application/xhtml+xml'>"; $content .= "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>"; $content .= "</content>"; $content .= "</entry>";
But now it gives error at the first line of this code...
Last edited by CasTex; Jan 12th, 2009 at 1:28 am.
i tried this:
and there were no errors on my server.
PHP Syntax (Toggle Plain Text)
$content = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>'; $content .= "<entry xmlns='http://purl.org/atom/ns#'>"; $content .= "<title mode='escaped' type='text/plain'>".$title."</title>"; $content .= "<issued>".$issued."</issued>"; $content .= "<generator url='http://www.yoursitesurlhere.com'>client's name</generator>"; $content .= "<content type='application/xhtml+xml'>"; $content .= "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>"; $content .= "</content>"; $content .= "</entry>";
•
•
Join Date: Mar 2008
Posts: 39
Reputation:
Solved Threads: 0
Really thanks, but now I get this error
Parse error: syntax error, unexpected T_DNUMBER at line 25
My full code is this
Parse error: syntax error, unexpected T_DNUMBER at line 25

My full code is this
<?php
/*
Script by CasTex
*/
// post tarihi
$issued=gmdate("Y-m-d\TH:i:s\Z", time());
// post title kısmı
$title="bakalim oliyir mii";
// postun body kısmı
$body="yaz buraya bişiler ne bilim ben.";
// blogid sini yaz
$blog_id="7421378769979406050";
// kullanici adi ve parola
$your_username="xxx"; //change this to your blogger login username
$your_password="xxx; // change this to your blogger login password
$soru = "?";
// bloga yollanacak xml data
$content = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>';
$content .= "<entry xmlns='http://purl.org/atom/ns#'>";
$content .= "<title mode='escaped' type='text/plain'>".$title."</title>";
$content .= "<issued>".$issued."</issued>";
$content .= "<generator url='http://www.yoursitesurlhere.com'>client's name</generator>";
$content .= "<content type='application/xhtml+xml'>";
$content .= "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>";
$content .= "</content>";
$content .= "</entry>";
// bloga yollancak header
$headers = array( "Content-type: application/atom+xml" );
// Use curl to post to your blog.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.blogger.com/atom/".$blog_id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERPWD, $your_username.':'.$your_password);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
$data = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
}
// sonucu bas
echo $data;
?> Last edited by CasTex; Jan 12th, 2009 at 2:10 am.
you are missing a quotation on this line:
PHP Syntax (Toggle Plain Text)
$your_password="xxx; // change this to your blogger login password
•
•
Join Date: Jan 2008
Posts: 79
Reputation:
Solved Threads: 9
You must change your code on line 25 like this:
PHP Syntax (Toggle Plain Text)
$content = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>";
My suggestion is to ditch whatever editor you are using, and set up an editor with code highlighting
the missing quotes, semicolons and other syntax errors would then be highlighted while you are editing.
the missing quotes, semicolons and other syntax errors would then be highlighted while you are editing.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Similar Threads
- Parse error: syntax error, unexpected T_STRING (PHP)
- Parse error: syntax error, unexpected T_STRING (PHP)
- Parse error: syntax error, unexpected T_STRING in E:\Program Files\wamp\www\practice\ (PHP)
- Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' (PHP)
- emergency please help fo Parse error: syntax error, unexpected T_STRING (PHP)
- syntax error, unexpected T_STRING (PHP)
- "syntax error, unexpected T_STRING"...? (PHP)
- Parse error: syntax error, unexpected T_STRING in c:/.......... (PHP)
- Unexpected T_STRING? (PHP)
Other Threads in the PHP Forum
- Previous Thread: Online payment Help
- Next Thread: Shopping cart
| Thread Tools | Search this Thread |
ajax apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail match md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem protocol query radio random recursion regex remote script search server session sessions sms smtp soap source space sql strip_tags survey syntax system table tutorial undefined update upload url validator variable video virus votedown web window.onbeforeunload=closeme; xml youtube






