1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: file_get_contents issue

Discussion in 'Web Design & Development' started by cpscdave, Apr 26, 2010.

Thread Status:
Not open for further replies.
  1. cpscdave

    cpscdave Thread Starter

    Joined:
    Feb 25, 2004
    Messages:
    444
    So here is the basic code that I am using
    PHP:
            $request "https://someserver.com";
        
    $request.="?".urlencode($xml_string);
        
    $aContext= array(
                        
    'http' => array(
                                        
    'request_fulluri'=>True
                                        
    )
                        );
        

        
    $cxContext    stream_context_create($aContext);
        
        
    $xmlText    file_get_contents($request,FALSE,$cxContext);
    The problem is the server that I am making the request to is returning an error saying:

    Code:
    <txn>
    <errorCode>6042</errorCode>
    <errorName>Invalid Request Format</errorName>
    <errorMessage>XML request is not well-formed or request is incomplete.</errorMessage>
    </txn>
    
    But whats odd is if I output $request and put that into my web browser the server I'm making the request to accepts the inputs and is fine.

    Any idea why this is happening???

    Edit: If I do a redirect to $request the server again accepts the input, it only seems to error on the get_file_contents
     
  2. cpscdave

    cpscdave Thread Starter

    Joined:
    Feb 25, 2004
    Messages:
    444
    Figured it out.... well kinda
    I retyped out $xml_string as far as I can see exactly the same as before... but now it works..... /shrug
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/919379

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice