• 03-07-2013, 22:55:08
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    merhaba arkadaslar curl ile bi sayfaya upload yapmaya calisiyorum

    function post_files($url,$files) {
    
        $data = "file=".$files."";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
        $response = curl_exec($ch);
        return $response;
    }
    
    echo post_files("/api/hotlink","music.mp3");
    olay bu nerenin apisi oldugu fazla onemli degil ancak aldigim cevap su sekilde

    No input file specified.


    bunlarda sayfanin api dokumanlari..
    bir turlu yapamadim yardimci olabilcek varsa simdiden tesekkurler. paypal 1 $ atarim

    POST 'file'=FILE.JPG => https://*****.com/api
    {"status":"success","url":"http:\/\/cdn.****.com\/1329168423170.jpg"}

    POST 'file'=FILE.JPG => https://*****.com/api?plain
    https://****.com/file/af16b9c6375c02d94312d9f39621f471

    POST 'file'=FILE.JPG => https://*****.com/api/hotlink
    https://cdn.*****.com/1329168423170.jpg
  • 03-07-2013, 23:40:32
    #2
    interkolik adlı üyeden alıntı: mesajı görüntüle
    merhaba arkadaslar curl ile bi sayfaya upload yapmaya calisiyorum

    function post_files($url,$files) {
    
        $data = "file=".$files."";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
        $response = curl_exec($ch);
        return $response;
    }
    
    echo post_files("/api/hotlink","music.mp3");
    olay bu nerenin apisi oldugu fazla onemli degil ancak aldigim cevap su sekilde

    No input file specified.


    bunlarda sayfanin api dokumanlari..
    bir turlu yapamadim yardimci olabilcek varsa simdiden tesekkurler. paypal 1 $ atarim

    POST 'file'=FILE.JPG => https://*****.com/api
    {"status":"success","url":"http:\/\/cdn.****.com\/1329168423170.jpg"}

    POST 'file'=FILE.JPG => https://*****.com/api?plain
    https://****.com/file/af16b9c6375c02d94312d9f39621f471

    POST 'file'=FILE.JPG => https://*****.com/api/hotlink
    https://cdn.*****.com/1329168423170.jpg

    Merhabalar,

    Aşağıdaki verdiğim kodu denermisiniz?

    function post_files($url,$files) { 
    
        $Veri = array('name'=>'file', 'file'=>$files); 
        $ch = curl_init(); 
        curl_setopt($ch, CURLOPT_URL, $url); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); 
        curl_setopt($ch, CURLOPT_POST, true); 
        curl_setopt($ch, CURLOPT_POSTFIELDS, $Veri );  
        $response = curl_exec($ch); 
        return $response; 
    } 
    
    echo post_files("/api/hotlink","music.mp3");
  • 03-07-2013, 23:45:13
    #3
    era adlı üyeden alıntı: mesajı görüntüle
    Merhabalar,

    Aşağıdaki verdiğim kodu denermisiniz?

    function post_files($url,$files) { 
    
        $Veri = array('name'=>'file', 'file'=>$files); 
        $ch = curl_init(); 
        curl_setopt($ch, CURLOPT_URL, $url); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); 
        curl_setopt($ch, CURLOPT_POST, true); 
        curl_setopt($ch, CURLOPT_POSTFIELDS, $Veri );  
        $response = curl_exec($ch); 
        return $response; 
    } 
    
    echo post_files("/api/hotlink","music.mp3");

    sonuc ayni sekilde... tesekkur ederim denediginiz icin
  • 04-07-2013, 00:13:19
    #4
    interkolik adlı üyeden alıntı: mesajı görüntüle
    sonuc ayni sekilde... tesekkur ederim denediginiz icin
    Arkadaşın problemi özel mesaj yolu ile halledildi.

    Kodun düzenlenmiş hali aşağıdadır.

    <?php
    
    header("Content-Type: text/html; Charset=utf8");
    
    function Yukle($Dosya){
    	
    	$Ch = curl_init();
    	curl_setopt($Ch,CURLOPT_URL, 'https://xxxxxxxxx.com/api');
    	curl_setopt($Ch, CURLOPT_POST, 1);
    	curl_setopt($Ch, CURLOPT_POSTFIELDS, $Dosya);
    	curl_setopt($Ch, CURLOPT_RETURNTRANSFER, TRUE);
    	curl_setopt($Ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    	$Sonuc	= curl_exec($Ch);
    	curl_close($Ch);
    	return $Sonuc;
    	
    }
    
    $Dosya	= realpath('deneme.png');
    $Dosya	= array('file'=> '@'.$Dosya);
    
    echo Yukle($Dosya);
    
    ?>