Rajouter l"adresse IP du client fichier security.properties
accessRestrictionWSRestPhoto=hasIpAddress('127.0.0.1') or hasIpAddress('ip serveur') or ... |
print "<img src=\"thumbnail.php?code=".$eppn."\" width=125 height=150>"; |
<?php extract($_GET); Header("Content-type: image/jpeg"); $url = 'http://esup-sgc.univ-ville.fr:8080/wsrest/photo/'.$code.'/restrictedPhoto?cardEtat=ENABLED'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.1 Safari/537.11'); $res = curl_exec($ch); $rescode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch) ; echo $res; exit; ?> |
FUNCTION get_photo (p_url IN VARCHAR2) RETURN BLOB; |
FUNCTION get_photo (p_url IN VARCHAR2 ) RETURN BLOB IS l_http_request UTL_HTTP.req; l_http_response UTL_HTTP.resp; l_blob BLOB; l_raw RAW(32767); BEGIN -- Initialize the BLOB. DBMS_LOB.createtemporary(l_blob, FALSE); -- Make a HTTP request and get the response. l_http_request := UTL_HTTP.begin_request(p_url); l_http_response := UTL_HTTP.get_response(l_http_request); -- Copy the response into the BLOB. BEGIN LOOP UTL_HTTP.read_raw(l_http_response, l_raw, 32766); DBMS_LOB.writeappend (l_blob, UTL_RAW.length(l_raw), l_raw); END LOOP; EXCEPTION WHEN UTL_HTTP.end_of_body THEN UTL_HTTP.end_response(l_http_response); END; return l_blob; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(SQLERRM); END; |
select get_photo ( 'http://esup-sgc.univ-ville.fr:8080/wsrest/photo/toto@univ-ville.fr/restrictedPhoto?cardEtat=ENABLED') photo , ..... |