• 09-05-2014, 20:21:49
    #1
    S.a. arkadaşlar,

    Curl ile ilgili bir sorunum var. Resim yükleme sorunu. Ürün girişi ve diğer konularda sıkıntı yok fakat image yükleyemiyorum. Sistem opencart. Kendi siteme ürün yüklemeye çalışıyorum kısacası.

    İmage yüklerden alınan veriler.
    http://www.domain.tr/admin/index.php?route=common/filemanager/upload&token=a1f1f50ea3e3110de6fd72fdcf67950e
    
    POST /admin/index.php?route=common/filemanager/upload&token=a1f1f50ea3e3110de6fd72fdcf67950e HTTP/1.1
    Host: www.domain.tr
    User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3
    Accept-Encoding: gzip, deflate
    Referer: http://www.domain.tr/admin/index.php?route=common/filemanager&token=a1f1f50ea3e3110de6fd72fdcf67950e&field=image
    Cookie: language=TR; currency=USD; some_name=4bc05a270430c8dc04cf92468dff46df
    Connection: keep-alive
    Content-Type: multipart/form-data; boundary=---------------------------2729928327834
    Content-Length: 12638
    -----------------------------2729928327834
    Content-Disposition: form-data; name="directory"
    
    
    -----------------------------2729928327834
    Content-Disposition: form-data; name="image"; filename="resim.JPG"
    Content-Type: image/jpeg
    
    ÿØÿà
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,'http://www.domain.tr/admin/index.php?route=common/filemanager/upload&token='.$token[1].'');
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT,60);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_HEADER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER,$header);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION,1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,0);
    curl_setopt($curl, CURLOPT_FRESH_CONNECT,true);
    curl_setopt($curl, CURLOPT_COOKIESESSION, false);
    curl_setopt($curl, CURLOPT_COOKIEJAR,dirname(__FILE__).'/kuki.txt');
    curl_setopt($curl, CURLOPT_COOKIEFILE,dirname(__FILE__).'/kuki.txt');
    curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
    curl_setopt($curl, CURLOPT_REFERER, 'http://www.domain.tr/admin/index.php?route=common/filemanager/upload&token='.$token[1].'');
    curl_setopt($curl, CURLOPT_POST,true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, array('directory' => '','filename' => @realpath('resim/kulak.PNG')));
    
    $veri = curl_exec($curl);
    Çıktı:
    HTTP/1.1 200 OK Date: Fri, 09 May 2014 17:14:41 GMT Server: LiteSpeed Connection: close X-Powered-By: PHP/5.2.17 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Type: text/html; charset=utf-8 Content-Length: 55 Vary: User-Agent  {"error":"Uyar\u0131: L\u00fctfen dizin se\u00e7iniz!"}
  • 10-05-2014, 01:33:17
    #2
    Curl ile ftp ye yükleyerek halletmek zorunda kaldım. Eğer konu hakkında detaylı bilgisi olan varsa bilgi almaktan menmuniyet duyarım.
  • 02-07-2014, 12:42:29
    #3
    Merhaba hocam, hallettiniz mi bilmiyorum ama basit bir hata gözden kaçmış curl php kodunda

    curl_setopt($curl, CURLOPT_POSTFIELDS, array('directory' => '','filename' => @realpath('resim/kulak.PNG')));
    burayı aşağıdaki kodla değiştirin

    curl_setopt($curl, CURLOPT_POSTFIELDS, array('directory' => '','filename' => '@'.realpath('resim/kulak.PNG')));
    dikkat ederseniz @ işaretini tırnak içine almamışsınız hocam.. @ simgesi string değeri taşıdığı için bu tür karakterler tırnak içerisine alınırlar. Bundan dolayı çalışmamış sizin kodunuz. ben localde test ettim çalışıyor hocam.. umarım işinizi görür..



    aLKaDraZ adlı üyeden alıntı: mesajı görüntüle
    S.a. arkadaşlar,

    Curl ile ilgili bir sorunum var. Resim yükleme sorunu. Ürün girişi ve diğer konularda sıkıntı yok fakat image yükleyemiyorum. Sistem opencart. Kendi siteme ürün yüklemeye çalışıyorum kısacası.

    İmage yüklerden alınan veriler.
    http://www.domain.tr/admin/index.php?route=common/filemanager/upload&token=a1f1f50ea3e3110de6fd72fdcf67950e
    
    POST /admin/index.php?route=common/filemanager/upload&token=a1f1f50ea3e3110de6fd72fdcf67950e HTTP/1.1
    Host: www.domain.tr
    User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3
    Accept-Encoding: gzip, deflate
    Referer: http://www.domain.tr/admin/index.php?route=common/filemanager&token=a1f1f50ea3e3110de6fd72fdcf67950e&field=image
    Cookie: language=TR; currency=USD; some_name=4bc05a270430c8dc04cf92468dff46df
    Connection: keep-alive
    Content-Type: multipart/form-data; boundary=---------------------------2729928327834
    Content-Length: 12638
    -----------------------------2729928327834
    Content-Disposition: form-data; name="directory"
    
    
    -----------------------------2729928327834
    Content-Disposition: form-data; name="image"; filename="resim.JPG"
    Content-Type: image/jpeg
    
    ÿØÿà
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,'http://www.domain.tr/admin/index.php?route=common/filemanager/upload&token='.$token[1].'');
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT,60);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_HEADER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER,$header);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION,1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,0);
    curl_setopt($curl, CURLOPT_FRESH_CONNECT,true);
    curl_setopt($curl, CURLOPT_COOKIESESSION, false);
    curl_setopt($curl, CURLOPT_COOKIEJAR,dirname(__FILE__).'/kuki.txt');
    curl_setopt($curl, CURLOPT_COOKIEFILE,dirname(__FILE__).'/kuki.txt');
    curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
    curl_setopt($curl, CURLOPT_REFERER, 'http://www.domain.tr/admin/index.php?route=common/filemanager/upload&token='.$token[1].'');
    curl_setopt($curl, CURLOPT_POST,true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, array('directory' => '','filename' => @realpath('resim/kulak.PNG')));
    
    $veri = curl_exec($curl);
    Çıktı:
    HTTP/1.1 200 OK Date: Fri, 09 May 2014 17:14:41 GMT Server: LiteSpeed Connection: close X-Powered-By: PHP/5.2.17 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Type: text/html; charset=utf-8 Content-Length: 55 Vary: User-Agent  {"error":"Uyar\u0131: L\u00fctfen dizin se\u00e7iniz!"}
  • 04-07-2014, 01:50:20
    #4
    clic adlı üyeden alıntı: mesajı görüntüle
    Merhaba hocam, hallettiniz mi bilmiyorum ama basit bir hata gözden kaçmış curl php kodunda

    curl_setopt($curl, CURLOPT_POSTFIELDS, array('directory' => '','filename' => @realpath('resim/kulak.PNG')));
    burayı aşağıdaki kodla değiştirin

    curl_setopt($curl, CURLOPT_POSTFIELDS, array('directory' => '','filename' => '@'.realpath('resim/kulak.PNG')));
    dikkat ederseniz @ işaretini tırnak içine almamışsınız hocam.. @ simgesi string değeri taşıdığı için bu tür karakterler tırnak içerisine alınırlar. Bundan dolayı çalışmamış sizin kodunuz. ben localde test ettim çalışıyor hocam.. umarım işinizi görür..
    Eyvallah hocam çok sağol. Valla açık konuşmak gerekirse @ string bir ifade olacağını bilmiyordum. Sayende öğrenmiş olduk sağolasın