Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/10/2012, 13:44
nicogd93
 
Fecha de Ingreso: octubre-2012
Mensajes: 15
Antigüedad: 11 años, 6 meses
Puntos: 2
Error en syntax error, unexpected'<'

Hola amigos estoy desarrollando una aplicación para face y me da error: Parse error: syntax error, unexpected '<' in /home/topfashi/public_html/h/tab.php on line 186

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

Que es lo que leí me falta abrir o cerrar uno de estos {
Ayudenme

Este es el codigo:
Código 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$im31455600$new_w+20$new_h+20$w$h-30);
            
imagecopyResampled($im2$image1556600$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($im2300$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($chCURLOPT_URL,'https://graph.facebook.com/'.$_R['user_id'].'/photos?access_token='.$_R['oauth_token']);
            
curl_setopt($chCURLOPT_POSTtrue);
            
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($chCURLOPT_POSTFIELDS$_P);
            
$resultado curl_exec($ch);
            
$resultado json_decode($resultadotrue);
            
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_request2);

            
$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($ch2CURLOPT_URL$U);
        
curl_setopt($ch2CURLOPT_HEADERtrue);
        
curl_setopt($ch2CURLOPT_RETURNTRANSFERtrue);
        
$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