Error de sintaxis inesperado '<' en aplicacion de desarrollo

  • Autor Autor nicogd93
  • Fecha de inicio Fecha de inicio
N

nicogd93

No recomendado
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Hola amigos estoy desarrollando una aplicacion y me da error: Parse error: syntax error, unexpected '<' in /home/topfashi/public_html/h/tab.php on line 186
Que es lo que lei me falta abrir o cerrar uno de estos {
Ayudenme :grumpy:
Este es el codigo:




PHP:
[PHP]<?php
	@set_time_limit(0);

	$_PAGEID	= 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
	$_APPID		= 'XXXXXXXXXXXXXXXXXXXX';
	$_APPSE		= 'xxxxxxxx';
	$_PERMISOS	= 'publish_stream,photo_upload,user_photos';
	$_MSERVER	= '//topfashionlike.com/h/';
	$_ADS		= '//xxxxxxxxxxx';
	$GOOGLEURL	= 'http://xxxxxxxxxxxxx'; //Url de la aplicacion en la fanpage

	//Obtenemos Los datos del usuario
	$_R = _SR($_REQUEST['signed_request'],$_APPSE);

	echo '<center>';
	echo '<iframe src="'.$_ADS.'" style="border:0px;" width="728" height="90" scrolling="no" frameborder="0"></iframe><br/>';

	//Verificamos si es fan
	if($_R['page']['liked']){
		if($_R['oauth_token']==""){
			PedirP();
		}else{
			//Obtenemos los datos del usuario
			$A = file_get_contents('https://graph.facebook.com/'.$_R['user_id'].'?access_token='.$_R['oauth_token']);
			$A = json_decode($A,true);

			//Obtenemos los amigos
			$AM = file_get_contents('https://graph.facebook.com/'.$_R['user_id'].'/friends?fields=id,name,picture,first_name&access_token='.$_R['oauth_token']);
			$AM = json_decode($AM,true);
			//Obtenemos un amigo al azar
			$QM = $AM['data'][array_rand($AM['data'],1)];

			//Verificamos si ya dio permisos
			$BM = file_get_contents('https://graph.facebook.com/'.$_R['user_id'].'/permissions?access_token='.$_R['oauth_token']);
			$BM = json_decode($BM,true);

			if( !array_key_exists('publish_stream', $BM[data][0]) ) {
				PedirP();
			}

			//Paso previo, mostramos la imagen y el boton subir imagen.
		    if($_REQUEST['crear']==""){
			//Fuente a usar
			$font = 'lsansi.ttf';
			//Vemos la url real del amigo
			$image = open_image(VerRealURL('http://graph.facebook.com/'.$MQ['id'].'/picture?type=large'));die();

			if ($image === false) { die ('Unable to open image'); }

			//Tamaño de la imagen
			$w = imagesx($image);
			$h = imagesy($image);

			//Tamaño maximo 200x200 (sin deformar)
			$new_w=200;
			$new_h=200;
			if(($w/$h) > ($new_w/$new_h)){
				$new_h=$new_w*($h/$w);
			} else {
				$new_w=$new_h*($w/$h);   
			}

			//Cargamos el fondo
			$im2 = imagecreatefromjpeg('fondo.jpg');
			//Cargamos el recuadro
			$im3 = imagecreatefromjpeg('cuadro.jpg');
			//Agregamos la foto y el recuadro
			imagecopyResampled($im2, $im3, 145, 56, 0, 0, $new_w+20, $new_h+20, $w, $h-30);
			imagecopyResampled($im2, $image, 155, 66, 0, 0, $new_w, $new_h, $w, $h);
		
			//Colo blanco
			$textcolor = imagecolorallocate($im2,255,255,255);
			//Primer nombre del amigo
			$text1 = $QM['first_name'];

			//Centramos el texto en la imagen
			$bbox = imagettfbbox(30,$angle,$font,$text1);
			$textWidth = $bbox[2]-$bbox[0];
			$z=$bbox[2]/2;
			$x=250-$z; //250 es la mitad del tamaño de la imagen
			$y=43; //43 es la coordenada y

			//Agregamos el nombre
			imagettftext($im2, 30, 0, $x+2,$y+2, $textcolor, $font, $text1);

			//Guardamos la img
			imagejpeg($im2,'tmp/tmp_'.$A['id'].'.jpg',90);
			//Vaciamos la memoria
			imagedestroy($im2);

			//Mostramos el resultado
			echo '<table border="0"><tr><td><div align="center"><span class="color"></span><br/><img src="tmp/tmp_'.$A['id'].'.jpg?t='.time().'" width="450px"><br/><a href="'.$_MSERVER.'tab.php?crear=1&amigo='.$QM['id'].'&signed_request='.$_REQUEST['signed_request'].'"><img src="pic/boton.png" border="0"></a></div></td><td><center>publi 300x250</center></td></tr></table>';
		    }else{
			//Texto de la foto
			$_TXT_ENVIAR	= 'El banana del dia '.$GOOGLEURL.' - '.$A['first_name'].', Ya lo Descubrio...';
			$_P['message'] 	= trim($_TXT_ENVIAR);
			//Etiquetamos al amigo
			$_P['tags']	= json_encode(array(array('tag_uid'=> $_REQUEST['amigo'],'x'=>50,'y'=>50)));
			$_P['source'] = "@" . realpath('tmp/tmp_'.$_R['user_id'].'.jpg');
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/'.$_R['user_id'].'/photos?access_token='.$_R['oauth_token']);
			curl_setopt($ch, CURLOPT_POST, true);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
			curl_setopt($ch, CURLOPT_POSTFIELDS, $_P);
			$resultado = curl_exec($ch);
			$resultado = json_decode($resultado, true);
			curl_close($ch);

			echo '<h1>Imagen subida con exito</h1>';
		    }
		}
	}else{
		//Boton de like (no es fan)
		echo '<img src="http://3.bp.blogspot.com/-cEBaUmP0qYo/TiuJDQ51btI/AAAAAAAAAKg/sm8mnFB_Kqg/s1600/clickenmegusta.jpg">';
	

	echo '<br/><iframe src="'.$_ADS.'" style="border:0px;" width="728" height="90" scrolling="no" frameborder="0"></iframe><br/>';
	echo '</center>';

	function _SR($signed_request, $secret) {
        	list($encoded_sig, $payload) = explode('.', $signed_request, 2);

	        $sig = base64_url_decode($encoded_sig);
        	$data = json_decode(base64_url_decode($payload), true);

	        if(strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
        	        error_log('Unknown algorithm. Expected HMAC-SHA256');
                	return null;
	        }

	        $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
        	if($sig !== $expected_sig) {
	                error_log('Bad Signed JSON signature!');
        	        return null;
	        }

	        return $data;
	}

	function base64_url_decode($input) {
        	return base64_decode(strtr($input, '-_', '+/'));
	}

	function PedirP(){
		global $_APPID,$_PAGEID,$_PERMISOS;
		echo "<script>
  		var oauth_url = 'https://www.facebook.com/dialog/oauth/';
		oauth_url += '?client_id=".$_APPID."';
		oauth_url += '&redirect_uri=' + encodeURIComponent('https://www.facebook.com/pages/null/".$_PAGEID."/?sk=app_".$_APPID."');
		oauth_url += '&scope=".$_PERMISOS."'

		window.top.location = oauth_url;
		</script>";
		die();
	}

	function VerRealURL($U){
		$ch2 = curl_init();
		curl_setopt($ch2, CURLOPT_URL, $U);
		curl_setopt($ch2, CURLOPT_HEADER, true);
		curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
		$ZZ = curl_exec($ch2);
		curl_close($ch2);

		preg_match('/Location:(.*?)\n/', $ZZ, $matches);
		return trim(array_pop($matches));
	}

	function open_image($file){
	    $size = getimagesize($file);
	    switch($size["mime"]){
        	case "image/jpeg":
       		    $im = imagecreatefromjpeg($file); //jpeg file
        	    break;
	        case "image/gif":
		    $im = imagecreatefromgif($file); //gif file
	            break;
	       	case "image/png":
		    $im = imagecreatefrompng($file); //png file
	       	    break;
	        default: 
		    $im=false;
	            break;
	    }
	    return $im;
<?php
[/PHP]
 
el php se cierra así ?>, al final tu pusiste <?php eso es lo que he visto a simple vista...
 
Si lo cierro como decis vos me da este error: Parse error: syntax error, unexpected $end in /home/topfashi/public_html/h/tab.php on line 186
<?php tengo que cerrarlo sin abreviaturas. Que otra cosa sera?
 
Dragonvm está en lo correcto

Si lo cierro como decis vos me da este error: Parse error: syntax error, unexpected $end in /home/topfashi/public_html/h/tab.php on line 186
<?php tengo que cerrarlo sin abreviaturas. Que otra cosa sera?

Eso pasa por que después del return $im; va una llave, queda así

PHP:
        return $im; 
<?php

Lo reemplazas por

PHP:
return $im;
}
?>
 
Atrás
Arriba