title: spell check using google.com/tbproxy/spell
body: <p>I am using google spell check in my project and doing everything as suggested in the blogs but it doesn't seem to work for me. Can you please look at this and tell me what I am doing incorrect.</p>
  
  <p>In my JavaScript:</p>
  
  <pre><code>function makeRequest(parameters, svalue) {  
    console.log("dv-- inside makerequest 1");
    console.log("svalue =", svalue);
    http_request.onreadystatechange = GetResponse;
    http_request.open('POST', 'http://mysite.com/Project/spellify.php?lang=en', true);    
  
    data = '&lt;?xml version="1.0" encoding="utf-8" ?&gt;';
    data +='&lt;spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="0" ignoreallcaps="0"&gt;&lt;text&gt;';
    data += svalue;
    data += '&lt;/text&gt;&lt;/spellrequest&gt;';
    console.log("data =", data)
    http_request.send(data);
  }
  
  function GetResponse(){
    console.log("dv-- inside GetResponse-1 http_request.readyState =", http_request.readyState)
    if (http_request.readyState == 4) {
  console.log("dv-- inside GetResponse-2 http_request.status =", http_request.status)
      if (http_request.status == 200) {
    http_response = http_request.responseText;
    console.log("dv --http_response =", http_response)
      }
      else {
        console.log('There was a problem with the request' + '&amp; http_request.status =' + http_request.status );
      }
    }
  }
  </code></pre>
  
  <p>My PHP Code: spellify.php
      
  
  <pre><code>$url="http://www.google.com/tbproxy/spell?lang=en&amp;hl=en";
  //$data = file_get_contents('php://input');
  $data = '&lt;?xml version="1.0" encoding="utf-8" ?&gt;&lt;spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="0" ignoreallcaps="0"&gt;&lt;text&gt;hellow  &lt;/text&gt;&lt;/spellrequest&gt;';
  
  $data = urldecode($data);
  
  $ch = curl_init();
  curl_setopt ($ch, CURLOPT_URL, $url);
  curl_setopt ($ch, CURLOPT_POST, 1);
  curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  $contents = curl_exec ($ch);
  curl_close ($ch); 
  
  print $contents;
  ?&gt;
  </code></pre>
  
  <p>I tried hardcoding the data in my php to make sure data was passed correctly and that is not an issue.    </p>
  
  <p>Firefox give an error:
      <code>Error: unclosed token
  </code>Source File: <code>http://mysite.com/Project/spellify.php?lang=en
  </code>Line: 5, Column: 183
      <code>Source Code:
  </code>$<code>data =</code>'&lt;<code>?xml version="1.0" encoding="utf-8" ?&gt;&lt;</code>spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="0" ignoreallcaps="0">&lt;<code>text&gt;hello thsi is graet&lt;</code>/text>&lt;`/spellrequest>';</p>
  
  <p>Chrome doesn't give any error, but show below in console:</p>
  
  <pre><code>dv-- inside makerequest 1
  spellify.js:419svalue = hello worlda 
  spellify.js:432dv-- inside GetResponse-1 http_request.readyState = 1
  spellify.js:427data = &lt;?xml version="1.0" encoding="utf-8" ?&gt;&lt;spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="0" ignoreallcaps="0"&gt;&lt;text&gt;hello worlda &lt;/text&gt;&lt;/spellrequest&gt;
  spellify.js:432dv-- inside GetResponse-1 http_request.readyState = 2
  spellify.js:432dv-- inside GetResponse-1 http_request.readyState = 3
  spellify.js:432dv-- inside GetResponse-1 http_request.readyState = 4
  spellify.js:435dv-- inside GetResponse-2 http_request.status = 200
  spellify.js:438dv --http_response = &lt;?php
  
  $url="http://www.google.com/tbproxy/spell?lang=en&amp;hl=en";
  // $data = file_get_contents('php://input');
  $data = '&lt;?xml version="1.0" encoding="utf-8" ?&gt;&lt;spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="0" ignoreallcaps="0"&gt;&lt;text&gt;hello thsi is graet&lt;/text&gt;&lt;/spellrequest&gt;';
  $data = urldecode($data);
  
  $ch = curl_init();
  curl_setopt ($ch, CURLOPT_URL, $url);
  curl_setopt ($ch, CURLOPT_POST, 1);
  curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
  $contents = curl_exec ($ch);
  curl_close ($ch); 
  
  print $contents;
  ?&gt;
  </code></pre>
  
  <p>Please suggest what could be corrected to make this work.</p>
  
  <p>Thanks</p>