Zadejte hledaný výraz...

Stiahnutie obrazku cez curl po vzdialenom zalogovani

Creator13
verified
rating uzivatele
(49 hodnocení)
11. 6. 2020 13:53:06
Potrebujem pomoc so stiahnutim obrazku pomocou curl po nalogovani sa do administracie. Skusal som externeho programatora, ale nezvladol to.
Prihlasenie pomocou curl zvladam. Nasledne chcem stiahnut obrazok a tu som v koncoch.
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: image/jpeg'));
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17');
curl_setopt( $ch, CURLOPT_URL, $value );
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile);
$html = curl_exec( $ch );
$httpStatus = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
$curlErrno = curl_errno( $ch );
file_put_contents( $this->destination . '/1.jpg', $html);
$info = curl_getinfo($ch);
var_dump($info);
var_dump($html);
curl_getinfo($ch) mi vyhodi nasledovne info
array (size=26)
'url' => string 'url obrazku' (length=68)
'content_type' => string 'image/jpeg' (length=10)
'http_code' => int 200
'header_size' => int 119
'request_size' => int 360
'filetime' => int -1
'ssl_verify_result' => int 20
'redirect_count' => int 0
'total_time' => float 0.014522
'namelookup_time' => float 5.4E-5
'connect_time' => float 5.6E-5
'pretransfer_time' => float 0.000164
'size_upload' => float 35
'size_download' => float 0
'speed_download' => float 0
'speed_upload' => float 2500
'download_content_length' => float 0
'upload_content_length' => float 35
'starttransfer_time' => float 0.014456
'redirect_time' => float 0
'redirect_url' => string '' (length=0)
'primary_ip' => string '82.99.162.116' (length=13)
'certinfo' =>
array (size=0)
empty
'primary_port' => int 443
'local_ip' => string '192.168.1.5' (length=11)
'local_port' => int 52543
Skusam rozne nastavenia curl_setopt, ale neuspesne. Ak ma niekto zaujem, tak aj zaplatim za pomoc. Inak diky za kazdu radu.
11. 6. 2020 13:53:06
https://webtrh.cz/diskuse/stiahnutie-obrazku-cez-curl-po-vzdialenom-zalogovani#reply1454543
Micruss
verified
rating uzivatele
11. 6. 2020 15:10:20
Ahoj,
hmmm co tohle?
https://stackoverflow.com/questions/6476212/save-image-from-url-with-curl-php
11. 6. 2020 15:10:20
https://webtrh.cz/diskuse/stiahnutie-obrazku-cez-curl-po-vzdialenom-zalogovani#reply1454542
Luděk Kvapil
verified
rating uzivatele
14. 6. 2020 14:34:28
Zkus něco takového:
14. 6. 2020 14:34:28
https://webtrh.cz/diskuse/stiahnutie-obrazku-cez-curl-po-vzdialenom-zalogovani#reply1454541
Pro odpověď se přihlašte.
Přihlásit