J
J
Jony13372016-08-21 08:50:53
PHP
Jony1337, 2016-08-21 08:50:53

How can I download photos from a social network through PHP?

There is a simple photo here
https://uld9.mycdn.me/image?t=3&bid=837709635998&i...
I can't download it even if I add .png or .jpg at the end

$ch = curl_init('https://uld9.mycdn.me/image?t=3&bid=837709635998&id=837709635998&plc=WEB&tkn=*MYroPNG-uFPmYCTtNrXfIIbfPuc.png/jpg');
$fp = fopen('./images/logo.png', 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2016-08-21
@Sanasol

You have to code another reference
image? T = 3 & bid = 837 709 635 998 & id = 837709635998 & plc = the WEB & tkn = * MYroPNG-uFPmYCTtNrXfIIbfPuc
vs
image? T = 3 & bid = 837 709 635 998 & id = 837709635998 & plc = WEB & tkn = * MYroPNG-uFPmYCTtNrXfIIbfPuc.png / jpg
In general, it is easier in 2 lines do file_get_contents and file_put_contents.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question