title: Twilio Verify API: "Requested URL was not found"
body: <p>I am using curl to perform a request to the Twilio Verify API, following the instructions here: <a href="https://www.twilio.com/verify/api" rel="nofollow noreferrer">https://www.twilio.com/verify/api</a></p>
  
  <p>Using these instructions, I've created two php files to perform the curl request -- one to get a verification code (<strong>get_code.php</strong>), and another to check the verification code (<strong>check_code.php</strong>). These scripts are called using an ajax post to send the parameters, and the two scripts are nearly identical, save for the URL ("/start" vs. "/check").</p>
  
  <p>I believe I am specifying the correct URLs, and <strong>get_code.php</strong> works, but <strong>check_code.php</strong> throws the following error:</p>
  
  <blockquote>
    <p>Requested URL was not found. Please check <a href="http://docs.authy.com/" rel="nofollow noreferrer">http://docs.authy.com/</a> to see the valid URLs.</p>
  </blockquote>
  
  <p><strong>get_code.php</strong></p>
  
  <pre><code>&lt;?php
  
  $USER_PHONE = htmlspecialchars($_POST["phone"]);
  
  $ch = curl_init();
  $curlConfig = array(
      CURLOPT_URL            =&gt; "https://api.authy.com/protected/json/phones/verification/start",
      CURLOPT_POST           =&gt; true,
      CURLOPT_RETURNTRANSFER =&gt; true,
      CURLOPT_POSTFIELDS     =&gt; array(
          'country_code' =&gt; '1',
          'via' =&gt; 'sms',
          'phone_number' =&gt; $USER_PHONE,
      ),
      CURLOPT_HTTPHEADER =&gt; array('X-Authy-API-Key: MY_KEY')
  );
  curl_setopt_array($ch, $curlConfig);
  $result = curl_exec($ch);
  curl_close($ch);
  
  echo $result;
  ?&gt;
  </code></pre>
  
  <p><strong>check_code.php</strong></p>
  
  <pre><code>&lt;?php
  
  $USER_PHONE = htmlspecialchars($_POST["phone"]);
  $VERIFY_CODE = htmlspecialchars($_POST["code"]);    
  
  $ch = curl_init();
  $curlConfig = array(
      CURLOPT_URL            =&gt; "https://api.authy.com/protected/json/phones/verification/check",
      CURLOPT_POST           =&gt; true,
      CURLOPT_RETURNTRANSFER =&gt; true,
      CURLOPT_POSTFIELDS     =&gt; array(
          'country_code' =&gt; '1',
          'phone_number' =&gt; $USER_PHONE,
          'verification_code' =&gt; $VERIFY_CODE
      ),
      CURLOPT_HTTPHEADER =&gt; array('X-Authy-API-Key: MY_KEY')
  );
  curl_setopt_array($ch, $curlConfig);
  $result = curl_exec($ch);
  curl_close($ch);
  
  echo $result;
  ?&gt;
  </code></pre>
  
  <p>I performed a curl manually in terminal using the same URL and parameters, and it worked.</p>
  
  <pre><code>curl "https://api.authy.com/protected/json/phones/verification/check?phone_number=MY_PHONE&amp;country_code=1&amp;verification_code=MY_CODE" -H "X-Authy-API-Key: MY_KEY"
  </code></pre>
  
  <p>I don't know what I could be doing wrong?</p>