Parse error: syntax error, unexpected T_STRING

Reply

Join Date: Mar 2008
Posts: 39
Reputation: CasTex has a little shameless behaviour in the past 
Solved Threads: 0
CasTex CasTex is offline Offline
Light Poster

Parse error: syntax error, unexpected T_STRING

 
0
  #1
Jan 11th, 2009
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>";
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,351
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 163
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Parse error: syntax error, unexpected T_STRING

 
0
  #2
Jan 11th, 2009
Originally Posted by CasTex View Post
I am getting error at the second line of the code, what is the problem

  1. $content = '<' . '?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?' . '>';
  2. $content .= "<entry xmlns='http://purl.org/atom/ns#'>";
  3. $content .= "<title mode='escaped' type='text/plain'>".$title."</title>";
  4. $content .= "<issued>".$issued."</issued>"
  5. $content .= "<generator url='http://www.yoursitesurlhere.com'>client's name</generator>";
  6. $content .= "<content type='application/xhtml+xml'>";
  7. $content .= "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>";
  8. $content .= "</content>";
  9. $content .= "</entry>";
concatenation
$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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 39
Reputation: CasTex has a little shameless behaviour in the past 
Solved Threads: 0
CasTex CasTex is offline Offline
Light Poster

Re: Parse error: syntax error, unexpected T_STRING

 
0
  #3
Jan 12th, 2009
Ok, I use this;

  1. $content = '<' . '?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?' . '>';
  2. $content .= "<entry xmlns='http://purl.org/atom/ns#'>";
  3. $content .= "<title mode='escaped' type='text/plain'>".$title."</title>";
  4. $content .= "<issued>".$issued."</issued>";
  5. $content .= "<generator url='http://www.yoursitesurlhere.com'>client's name</generator>";
  6. $content .= "<content type='application/xhtml+xml'>";
  7. $content .= "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>";
  8. $content .= "</content>";
  9. $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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: Parse error: syntax error, unexpected T_STRING

 
0
  #4
Jan 12th, 2009
i tried this:
  1. $content = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>';
  2. $content .= "<entry xmlns='http://purl.org/atom/ns#'>";
  3. $content .= "<title mode='escaped' type='text/plain'>".$title."</title>";
  4. $content .= "<issued>".$issued."</issued>";
  5. $content .= "<generator url='http://www.yoursitesurlhere.com'>client's name</generator>";
  6. $content .= "<content type='application/xhtml+xml'>";
  7. $content .= "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>";
  8. $content .= "</content>";
  9. $content .= "</entry>";
and there were no errors on my server.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 39
Reputation: CasTex has a little shameless behaviour in the past 
Solved Threads: 0
CasTex CasTex is offline Offline
Light Poster

Re: Parse error: syntax error, unexpected T_STRING

 
0
  #5
Jan 12th, 2009
Really thanks, but now I get this error

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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: Parse error: syntax error, unexpected T_STRING

 
0
  #6
Jan 12th, 2009
you are missing a quotation on this line:

  1. $your_password="xxx; // change this to your blogger login password
  2.  
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 79
Reputation: rudevils is an unknown quantity at this point 
Solved Threads: 9
rudevils rudevils is offline Offline
Junior Poster in Training

Re: Parse error: syntax error, unexpected T_STRING

 
0
  #7
Jan 12th, 2009
You must change your code on line 25 like this:

  1. $content = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>";
If love is blind, why there's a bikini ??

Post your article at Bali Side Notes share your knowledge
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,351
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 163
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Parse error: syntax error, unexpected T_STRING

 
0
  #8
Jan 12th, 2009
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.
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC