Autor Zpráva
mar
Profil *
Dobrý den,

zkouším na serveru, kde je zapnutý SAFE MOD, níže uvedený skript.
V safe mode mi to nefunguje.
Dá se nějak upravit, aby fungoval?

/*

* Private function called by @func preremplir_Formulaire() to detect site thumbnails

* @param string methode : which method should the function use to find the thumbnail ? (ascreen, thumshots...)

* @param string url : URL of the website concerned by the detection

* @return string : URL of the thumbnail found if success, else null

*/

function detect_images($methode,$url)

// Détecter une image via AscreeN, Thumbshots ou Alexa

{

$url_image = null;



if ( $methode=='ascreen' )

{

$urlt = rtrim($url,"/");



if ( @getimagesize("$urlt/ascreen.jpg") ) {

$url_image = "$urlt/ascreen.jpg";

};

}

elseif ( $methode=='thumbshots' )

{

if ( ($a=@getimagesize("http://open.thumbshots.org/image.pxf?url=$url")) && $a[0]>50 ) {

$url_image = "http://open.thumbshots.org/image.pxf?url=$url";

};

}

elseif( $methode=='thumbzor' )

{

if ( ($a=@getimagesize("http://www.thumbzor.com/tel.php?url=$url")) && $a[0]>50 ) {

$url_image = "http://www.thumbzor.com/tel.php?url=$url";

};

}

elseif( $methode=='websnapr' )

{

if ( ($a=@getimagesize("http://images.websnapr.com/?url=$url&size=S")) && $a[0]>50 ) {

$url_image = "http://images.websnapr.com/?url=$url&size=S";

};

}

elseif ( $methode=='alexa' )

{

$purl = parse_url("http://thumbnails.alexa.com/image_server.cgi?size=small&url =$url");



$fp = @fsockopen($purl['host'], 80, $errno, $errstr, 5);

@fputs($fp, "GET $purl[path]?$purl[query] HTTP/1.1\r\nHost: $purl[host]\r\n\r\nConnection: Close\r\n\r\n");

$ok = preg_match("!Location: /images/smalljpeg/!",@fread($fp,210));

@fclose($fp);



if ( $ok ) {

$url_image = "http://thumbnails.alexa.com/image_server.cgi?size=small&url=$url";

};

};



return $url_image;

}
Marcus Flintus
Profil
ano.
Jan Tvrdík
Profil
Marcus Flintus
:)
mar
Profil *
Děkuji
můžete mi ještě poradit jak?
Marcus Flintus
Profil
Problém je v řádcích
$fp = @fsockopen($purl['host'], 80, $errno, $errstr, 5);
@fputs($fp, "GET $purl[path]?$purl[query] HTTP/1.1\r\nHost: $purl[host]\r\n\r\nConnection: Close\r\n\r\n");
$ok = preg_match("!Location: /images/smalljpeg/!",@fread($fp,210));
@fclose($fp); 


protože v safe modu funkce fsockopen (a fce od ní odvozené) nefungují.
Musíš za ně hledat náhradu.
mar
Profil *
myslite pomoci CURL?
mardon
Profil *
Hledám někoho, kdo by mi byl ochoten pomoci se zprovzněním aplikace

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0