Jump to content

AdrienMenielle

Member
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

AdrienMenielle's Achievements

Helping Hand

Helping Hand (3/5)

0

Reputation

  1. Thank you, the iconv() solution works like a charm ! I knew it was normalization-related (thanks to help from people on Twitter) but i couldn't find the solution.
  2. Hi! I recently discovered Alfred and immediately bought the Powerpack. I'm loving it. I made my first workflow that allows me to look for synonyms on a french website called Synonymo. Here's the code : require("workflows.php"); $wf = new Workflows(); $word = "{query}"; $url = "http://www.synonymo.fr/synonyme/".$word; $raw = file_get_contents( $url ); $pattern = '/<a class="word".*>(.*)<\/a>/'; preg_match_all($pattern, $raw, $matches); foreach ($matches[1] as $key) { $wf->result( time(), $key, $key, 'Chercher '.$key, 'icon.png', 'yes', $key); } echo $wf->toxml(); It works like a charm, except with words containing accented characters, in which case i get the error : Warning: file_get_contents(http://www.synonymo.fr/synonyme/eĢtonner): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad request in Command line code on line 7 I tried urlencode() on the word and on the whole url, doesn't work (note that synonymo.fr shows non-encoded accented characters in the url) . I tried using $wf->request() instead of file_get_contents(), doesn't work either. Also, the exact same code works when run from a php file on my MAMP server (see attachment). I tried a lot of things, to no avail. Any help would be greatly appreciated
×
×
  • Create New...