Foros del Web » Programando para Internet » PHP »

Como enviar archivo por cURL - API de scan4you

Estas en el tema de Como enviar archivo por cURL - API de scan4you en el foro de PHP en Foros del Web. Hola, estoy haciendo un scanner usando la API de scan4you. En la web viene un ejemplo de cómo se hace: Código PHP: #!/usr/bin/php <?php $id ...
  #1 (permalink)  
Antiguo 20/05/2012, 14:43
 
Fecha de Ingreso: diciembre-2009
Mensajes: 27
Antigüedad: 14 años, 4 meses
Puntos: 1
Como enviar archivo por cURL - API de scan4you

Hola, estoy haciendo un scanner usando la API de scan4you. En la web viene un ejemplo de cómo se hace:

Código PHP:
#!/usr/bin/php
<?php
$id
="***";
$token="**********";
$url='http://scan4you.net/remote.php';
$type='file';
$options=getopt('t:d:e:l');
$file=$argv[$argc-1];
$link=0;
$format='txt'// json - for JSON return
$disable='';
$enable='';
if (@
$options['t']) $type $options['t'];
if (@
$options['l'] === false$link 1;
if (@
$options['d']) $disable = @$options['d'];
if (@
$options['e']) $enable = @$options['e'];

if ((
$type!='file' && $type!='domain' && $type!='url' && $type!='exploit') || $file==''){
    print 
"\n./upload.php [-t type] [-d av1,av2,av3] filename\n".
        
"    -t        type of check may be `file', `url', or `domain'\n".
        
"            file - make virus check on file (default)\n".
        
"            url - make virus check on\n".
        
"            domain - make check in blacklist from domain/url/IP\n".
        
"            exploit - make check of Exploit Pack\n".
        
"    -d        disable some av for this check, full list of av you\n".
        
"            can see at: http://scan4you.biz/version.php\n".
        
"    -e        enable only this av for this check ('all' if you want to enable all av),\n".
        
"            full list of av you can see at: http://scan4you.biz/version.php\n".
        
"    -l        add url to result page to the end of results".
        
"\n";
    exit();
}
if ((
$type == 'file') && (!file_exists($file))) die ("$file dosn`t exist.\n");
$ch curl_init();
curl_setopt($chCURLOPT_HEADER0);
curl_setopt($chCURLOPT_VERBOSE0);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_URL$url);
curl_setopt($chCURLOPT_POSTtrue);
$post = array('id'=>$id,'token'=>$token,'action'=>$type);
if (
$disable$post['av_disable']=$disable;
if (
$enable$post['av_enabled']=$enable;
if (
$link$post['link']=1;
if (
$type != 'file'$post[$type]=$file;
else 
$post['uppload']='@'.$file;
$post['frmt']=$format;
curl_setopt($chCURLOPT_POSTFIELDS$post);
$response curl_exec($ch);
if (
$response === false || curl_errno($ch) || curl_getinfo($chCURLINFO_HTTP_CODE) != 200){
    echo 
'ERROR:'.curl_error($ch);
    exit;
}
echo 
$response;
?>
Según se ve hay que enviar el archivo por cURL al servidor de sac4you. Mi problema está en que no consigo enviarlo de forma que funcione, alguien me podría ayudar?

De ante mano gracias.
  #2 (permalink)  
Antiguo 22/05/2012, 14:39
Avatar de bet7o  
Fecha de Ingreso: febrero-2010
Ubicación: DF
Mensajes: 315
Antigüedad: 14 años, 2 meses
Puntos: 20
Respuesta: Como enviar archivo por cURL - API de scan4you

Mira lo que he encontre, espero te sirva

http://dtbaker.com.au/random-bits/up...rl-in-php.html

Saludos!
__________________
Pero el no contaba con una cosa, mi peligroso desinteres por la vida humana

Etiquetas: api, curl
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:19.