title: Fatal error: Call to a member function asXML() on a non-object
body: <p>I know similar questions have already been asked, however, I have tried the solutions without any success. I keep getting this error:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function asXML() on a non-object in
    ... on line 188</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>$dom-&gt;save("productInfo.xml");
  $feedHandle = file_get_contents("productInfo.xml");
  
   $params = array(
  'AWSAccessKeyId'=&gt; "*****",
  'Action'=&gt;"SubmitFeed",
  'SellerId'=&gt; "********",
  'SignatureMethod' =&gt; "HmacSHA256",
  'SignatureVersion'=&gt; "2",
  'Timestamp'=&gt; gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()),
  'Version' =&gt; "2009-01-01",
  'FeedContent' =&gt; $feedHandle,//must be a string
  'FeedType' =&gt; "_POST_PRODUCT_DATA_");
  
   // Sort the URL parameters
  $url_parts = array();
  foreach(array_keys($params) as $key)
  $url_parts[] = $key . "=" . str_replace('%7E', '~', rawurlencode($params[$key]));
    sort($url_parts);
  
    // Construct the string to sign
  $url_string = implode("&amp;", $url_parts);
  $string_to_sign = "GET\nmws.amazonservices.com\n/Feeds/2009-01-01\n" . $url_string;
  
    // Sign the request
  $signature = hash_hmac("sha256", $string_to_sign, "******", TRUE);
  
    // Base64 encode the signature and make it URL safe
  $signature = urlencode(base64_encode($signature));
  
  $url = "https://mws.amazonservices.com/Feeds/2009-01-01" . '?' . $url_string . "&amp;Signature=" . $signature;
  
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 15);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $response = curl_exec($ch);
  
    $parsed_xml = simplexml_load_string($response); 
  
    @fclose($feedHandle);
  
    Header('Content-type: text/xml');
    print($parsed_xml-&gt;asXML());
  </code></pre>
  
  <p>I know that <code>$parsed_xml === FALSE</code> so I know the processing of the XML is not working. I suspect it has something to do with <code>$feedHandle</code> as I was previously receiving an error that said FeedContent in the array <code>$params</code> was empty. I know the XML is formatted correctly as I have printed it out and also directly put it in the required field and it worked fine.                                                  Also, we used curl-ing in a similar file and it was working fine so I do not think that would be the issue either.</p>