0

It's a strange issue I'm facing. Here is the CURL request I'm sending:

    $fields = array(
        'action' => 'json',
        'region' => '',
        'states' => array('TX'),
        'start' => '4/2/2010',
        'end' => '4/2/2017',
        'internalcomments' => 'no'
    );
    $fields_string = http_build_query($fields);

    $ch = curl_init($url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POST, count($fields));
    curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
    $jsonResult = curl_exec($ch);
    curl_close($ch);

However, when I'm printing out the content of the $fields_string, I see a trademark icon in the query string:

action=json®ion=&states%5B0%5D=AL&states%5B1%5D=TX&start=04%2F01%2F2010&end=04%2F07%2F2017&internalcomments=no

Notice the ® icon after the word json? Any idea where that's coming from?

farjam
  • 2,089
  • 8
  • 40
  • 77
  • 2
    Its `print '&reg'`; do `print $fields_string = htmlentities(http_build_query($fields));` to see the real content. Query is ok. – JustOnUnderMillions Apr 07 '17 at 15:13
  • http://stackoverflow.com/questions/6132721/http-build-query-without-url-encoding#8616340 – Matt Apr 07 '17 at 15:15
  • It is typical for the html world a browser ignores the missing `;` at the end and evaluates what he can. Test: `print 'x&nbspx';` becomes `x x` , but full right syntax is `print 'x x';` – JustOnUnderMillions Apr 07 '17 at 15:16

0 Answers0