Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/11/2013, 07:21
Avatar de satanson123
satanson123
 
Fecha de Ingreso: julio-2012
Mensajes: 217
Antigüedad: 11 años, 9 meses
Puntos: 2
pre_macth_all en intentado de todo y no logro sacarlo

Hola amigos, les traigo mi problemita. Estoy creando en php una funcion para un shortcode en wordpress que llama "fuente".
Lo que hara sera tomar la url o link y obtener nombre de esta web, el error esta en que cuando una web tiene https me salta un error y si solo tiene www me sala error, bueno es obligatorio que tenga http para que funcione y quiero que funcione con https o http, mas abajo le dejo el codigo para ver que me falta.

Shortcode completo:

Código PHP:
add_shortcode'fuente''fuente_check_shortcode' );

function 
fuente_check_shortcode$atts$content null ) {
    
function 
getTitle($content){
    
$str file_get_contents($content);
    if(
strlen($str)>0){
        
preg_match("/\<title\>(.*)\<\/title\>/",$str,$title);
        return 
$title[1];
    }
}
    
$ti getTitle($content);
    
            return 
'
            <style>
            #fuente{            
                    float:left;
                    width:100%;
                    text-align:left;
                    padding: 10px 0 10px 0;
                    margin: 0 0 0 -10px;
                    color: #000;
                    text-decoration: none;
                    z-index:100;
                    font-family: "Lato", Helvetica, Arial, sans-serif;
            }
            #info{
                    float:left;
                    margin-left:10px;
                    color: #000;
                    text-decoration: none;
                    font-family: "Lato", Helvetica, Arial, sans-serif;    
                    font-weight: 500;
                    font-size:18px;            
                
                }
            </style>

            
            <div id="fuente">
            
            <span id="info">Fuente de información:</span><span style="float:left; padding: 5px 0 0 7px;"><hr style="width:528px;position:absolute;color:#E6E6E6"></span>
            <br>
            <br>
            <br>
            <span style="float:left;padding:0 10px 0;"><img src="http://g.etfv.co/'
.$content.'" width="16" height="16"></span><span><a href="'.$content.'"><b>'.$ti.'</b></a></span>
</div>
            '
;

    

La parte donde obtengo el titulo:

Código PHP:
function getTitle($content){
    
$str file_get_contents($content);
    if(
strlen($str)>0){
        
preg_match("/\<title\>(.*)\<\/title\>/",$str,$title);
        return 
$title[1];
    }
}
    
$ti getTitle($content); 
Y lo muesto con:

Código PHP:
$ti 
En conclusion si coloco la url con http todo funciona bien pero al colocarla con https sale esto

Cita:
Warning: file_get_contents() [function.file-get-contents]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in F:\Program\Web\xampp\htdocs\warez\wp-content\themes\mystique\functions.php on line 768

Warning: file_get_contents(https://google.com) [function.file-get-contents]: failed to open stream: Invalid argument in F:\Program\Web\xampp\htdocs\warez\wp-content\themes\mystique\functions.php on line 768