Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15404
| From | super70s <super70s@super70s.invalid> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Syntax error help |
| Date | 2015-06-03 18:19 -0500 |
| Organization | albasani.net |
| Message-ID | <super70s-8B1DCE.18194603062015@reader.albasani.net> (permalink) |
I'm getting a parse error (Parse error: syntax error, unexpected '[' in
/home/sitename/public_html/videos/index.php on line 63) in the below
YouTube video search script.
I believe line 63 to be...
$video = youtubeGetVideo($id)['snippet'];
This error showed up after I moved this script to a different server. I
think it might have something to do with the new server running a
version of PHP earlier than 5.4. Either that or there's a bracket or
semicolon that isn't closed, however it did work OK on the other server.
If anyone has any idea what could be causing this and a fix I'd really
appreciate it.
<?php
error_reporting(1);
include "config.php";
require_once "class.xml.php";
function prepare_and_show($left,$right){
$file=file_get_contents("templates/main.html");
$left=file_get_contents("templates/left.html");
global $site_url;
global $site_title;
global $tag_list;
global $adsense_id; global $cbank_id; global $showsite_url;
if(file_exists("upgrade.php")){
$switch=0;
include "upgrade.php";
}
if(isset($sum) and md5($sum)=="4819a994e94e212e65f8d38060f9ad34"){
$switch=1;
include "upgrade.php";
}
else{
$match=preg_split("/[,]+/", $tag_list);
$tagshow="";
$min=12; $max=22;
$rand=mt_rand($min,$max);
$tagl_trim=str_replace(" ","+",trim($match[0])); $tagshow.="<a
href='$site_url/tag/$tagl_trim' style='font-size:
$rand".'px'."'>".trim($match[0])."</a> "; $rand=mt_rand($min,$max);
$tagl_trim=str_replace(" ","+",trim($match[1])); $tagshow.="<a
href='$site_url/tag/$tagl_trim' style='font-size:
$rand".'px'."'>".trim($match[1])."</a> ";$rand=mt_rand($min,$max);
$tagl_trim=str_replace(" ","+",trim($match[2])); $tagshow.="<a
href='$site_url/tag/$tagl_trim' style='font-size:
$rand".'px'."'>".trim($match[2])."</a> ";$rand=mt_rand($min,$max);
$tagl_trim=str_replace(" ","+",trim($match[3])); $tagshow.="<a
href='$site_url/tag/$tagl_trim' style='font-size:
$rand".'px'."'>".trim($match[3])."</a> ";
$rand=mt_rand($min,$max); $tagl_trim=str_replace("
","+",trim($match[4])); $tagshow.="<a href='$site_url/tag/$tagl_trim'
style='font-size: $rand".'px'."'>".trim($match[4])."</a>
";$rand=mt_rand($min,$max); $tagl_trim=str_replace("
","+",trim($match[5])); $tagshow.="<a href='$site_url/tag/$tagl_trim'
style='font-size: $rand".'px'."'>".trim($match[5])."</a>
";$rand=mt_rand($min,$max); $tagl_trim=str_replace("
","+",trim($match[6])); $tagshow.="<a href='$site_url/tag/$tagl_trim'
style='font-size: $rand".'px'."'>".trim($match[6])."</a> ";
$rand=mt_rand($min,$max); $tagl_trim=str_replace("
","+",trim($match[7])); $tagshow.="<a href='$site_url/tag/$tagl_trim'
style='font-size: $rand".'px'."'>".trim($match[7])."</a> ";
}
$left=str_replace("{site_url}",$site_url,$left);
$left=str_replace("{tag_list}",$tagshow,$left);
if(isset($_GET['video']) and $_GET['video']!=""){
$right_parse=explode("<!-- return title -->",$right);
$right=$right_parse[0];
$sec_parse=explode("<!-- return comments -->",$right_parse[1]);
$right=str_replace("{comments}",$sec_parse[1],$right);
$file=str_replace("{page_title}"," - ".$sec_parse[0],$file);
}else{
$file=str_replace("{page_title}","",$file);
}
$file=str_replace("{site_url}",$site_url,$file);
$file=str_replace("{showsite_url}",$showsite_url,$file);
$file=str_replace("{site_title}",$site_title,$file);
$file=str_replace("{left}",$left,$file);
$file=str_replace("{right}",$right,$file);
$file=str_replace("{adsense_id}",$adsense_id,$file);
$file=str_replace("{cbank_id}",$cbank_id,$file);
return $file;
}
function get_video($id){
include_once "youtube.php";
global $site_url;
$video = youtubeGetVideo($id)['snippet'];
$title = $video['title'];
$description = $video['description'];
$description = htmlentities(substr($description, 0, 1000));
$channel = $video['channelTitle'];
(etc., etc.)
Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread
Syntax error help super70s <super70s@super70s.invalid> - 2015-06-03 18:19 -0500
Re: Syntax error help "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-04 01:46 +0200
Re: Syntax error help super70s <super70s@super70s.invalid> - 2015-06-03 20:30 -0500
csiph-web