napisałem prosty kod, który wyświetla formularz zapełniony treścią z FB (Wydarzenia).
$at = "tu jest kod accesstoken"; $id = $_GET['event_id']; $url = ("https://graph.facebook.com/$id?fields=id,name,cover,owner,description,location,end_time&access_token=$at"); $curl = curl_init(); curl_setopt( $curl, CURLOPT_URL, $url ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 ); $result = curl_exec( $curl ); curl_close( $curl ); $return = json_decode($result, true); $id = $return['id']; $autor = iconv('utf-8','iso-8859-2',$return['owner']['name']); $d = $return['description']; $decoded = iconv('utf-8','iso-8859-2',$d); $n = $return['name']; $decodedn = iconv('utf-8','iso-8859-2',$n); $cover = $return['cover']['source']; $s = $return['start_time']; $k = $return['end_time']; $l = $return['location']; $decodedl = iconv('utf-8','iso-8859-2',$l); echo '<p>Szczegóły wydarzenia:</p> <p> <form action="add2.php" method="post"> <p><b>ID wydarzenia:</b> <input type="text" name="event_id" value="'.$id.'"></p> <p><b>Nazwa wydarzenia:</b> <input type="text" name="nazwa" value="'.$decodedn.'" style="width: 500px;"></p> <p><b>Autor wydarzenia:</b> <input type="text" name="autor" value="'.$autor.'" style="width: 500px;"></p> <p><b>Start wydarzenia:</b> <input type="text" name="start" value="'.$decodeds.'" style="width: 500px;"></p> <p><b>Koniec wydarzenia:</b> <input type="text" name="end" value="'.$decodedk.'" style="width: 500px;"></p> <p><b>Miejsce:</b> <input type="text" name="miejsce" value="'.$decodedl.'" style="width: 500px;"></p> <p><b>Treść wydarzenia:</b> <textarea name="tresc" style="width: 500px; height: 500px; vertical-align: top;">'.nl2br($decoded).'</textarea></p> <p><b>Zdjęcie, plakat:</b></p><p><img src="'.$cover.'"></p> <p><b>Ikona (200x200):</b></p><p><img src="https://graph.facebook.com/'.$id.'/picture?type=large"></p> </form> </p>'; }
problem zaczyna się gdy np. w opisie wydarzenia są znaki specjalne (quoty, alt cody, etc.)
Pytanie: jak się ich pozbyć? Polskie znaki ogarniam za pomocą iconv ale gdy jest tam jakiś quot to ucina tekst.
To samo przy alt codach (masakra te znaczki są!).
Dzięki za pomoc!