wysyłam listę adresów URL z php mailem. Problem polega na tym, że dokładnie jedno łącze zostaje przekształcone. Jednak gdy próbuję wysłać tylko ten jeden link - działa.php mail niezręczna zmiana na wysłaną zawartość
Wynik w tej chwili:
....
https://scontent! .cdninst agram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/11049164_453900378092870_2016147159_n.jpg
....
kupna Wynik
...
https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/11049164_453900378092870_2016147159_n.jpg
....
Jak można zobaczyć! i pojawiają się pewne przestrzenie
To jest mój kod:
$to = '[email protected]';
$subject = 'mySubject';
$arr = json_decode($string, true);
$message = '';
$arr = $arr['data'];
foreach ($arr as &$value) {
$message .= $value.'<br />';
}
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $message, $headers);
Ciąg wygląda następująco:
$string = '{"data": ["https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/11049164_453900378092870_2016147159_n.jpg"]}';
jestem dekodowanie adresu URL z ciągiem JSON. Działa to dobrze, gdy używa się jednego. Obecnie testuję z około 30 linkami i tylko ten jeden link jest zepsuty.
Pomysły?
UPDATE:
przy użyciu:
echo $message;
ciąg wygląda dobrze. Problem pojawia się dopiero po wysłaniu wiadomości.
UPDATE 2: Pełna $ string:
$string = '{"data":[
"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/11022962_1622439674642143_1096883351_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/11022968_805054996198636_1309286009_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/11022880_1423922187907036_917404870_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/10986377_1627498740796578_1852142680_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s150x150/e15/928667_892060397523291_369749441_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xtf1/t51.2885-15/s150x150/e15/11024100_808085365911650_996017863_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s150x150/e15/11055960_1404015356578720_1277867740_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s150x150/e15/11055777_816808825080092_1542857273_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s150x150/e15/11055471_841674382559292_1230638428_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/11015498_361414020713408_1088438153_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s150x150/e15/11008375_798420746919485_1231742350_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/10787706_1073162062697744_958846105_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s150x150/e15/11055503_1563023603973925_1133173525_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/10413863_1600753446833891_1231697708_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11055726_1574126762827213_1177337723_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xtp1/t51.2885-15/s150x150/e15/11004987_1642603925967855_119269404_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s150x150/e15/11055693_902276879824326_64336413_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpf1/t51.2885-15/s150x150/e15/11049164_453900378092870_2016147159_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/10946319_803454546417844_1425116400_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s150x150/e15/11008004_1544347675828229_1335095984_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfp1/t51.2885-15/s150x150/e15/11008078_330573980474432_104629134_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s150x150/e15/11189632_1438250796488739_1920042106_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s150x150/e15/11373935_828515147227862_998871606_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s150x150/e15/11272073_1601246710147452_2026113921_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s150x150/e15/11191056_1566823826912605_513606088_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xat1/t51.2885-15/s150x150/e15/11176380_875274085879731_345551882_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s150x150/e15/11199535_1422045371437335_873505586_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s150x150/e15/11189551_1581295318796082_2009128397_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s150x150/e15/11208345_767477406707058_569575819_n.jpg",
"https://2kguzbby0.igsonar.com/hphotos-ak-xfp1/t51.2885-15/s150x150/e15/11193001_381540205362927_573897005_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s150x150/e15/11208605_1607125916200571_200672539_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11203404_1441230966188039_1468562464_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s150x150/e15/11208226_1607707389487979_2115490962_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11189286_415149128646596_1948742113_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s150x150/e15/11190217_352891078253491_608612571_n.jpg"]}';
proszę zaksięgować deklarację lub var_dump '$ string' –
Tak, ponieważ dla podanego łańcucha działa poprawnie. Proszę podać pełną listę zawierającą' $ string'? –
Musisz kodować mime swoją treść wiadomości. – umka