Variable values not appearing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Variable values not appearing

Post by michaelh613 »

I am trying to create an xml document as a string but find my values just are disappearing

Code: Select all

 
$plist = '<?xml version = "1.0"?>';
$plist .= '<REQUEST_GROUP MISMOVersionID="2.1">';
$plist .= '<REQUEST LoginAccountIdentifier="testuser"';
$plist .= ' LoginAccountPassword="testpass">';
//more data
$plist .= '<_RESIDENCE _StreetAddress="10655 Birch St"';              
$plist .= ' _City="Burbank"';     
$plist .= ' _State="CA" _PostalCode="20906" />'; 
 
It appears teh data <_ appears but not the rest of th data when I echo $plist.
scriptah
Forum Commoner
Posts: 27
Joined: Sat Mar 15, 2008 8:58 pm
Location: Long Island, NY

Re: Variable values not appearing

Post by scriptah »

Using only this snipped of code it will be impossible to help you.
Just trying to copy and paste it works.
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: Variable values not appearing

Post by michaelh613 »

scriptah wrote:Using only this snipped of code it will be impossible to help you.
Just trying to copy and paste it works.

Code: Select all

 
<?php    
     /**      * Define POST URL and also payload     */    
      $test = '<BORROWER BorrowerID="BorRec0001"';
      $plist = "<?xml version = \"1.0\"?>";
      $plist .= '<REQUEST_GROUP MISMOVersionID="2.1">';
      $plist .= '<REQUEST LoginAccountIdentifier="testuser"';
      $plist .= ' LoginAccountPassword="testpass">';
      $plist .= '<KEY _Name="MemberID" _Value="100"/>';           
      $plist .= '<REQUEST_DATA>'; 
      $plist .= '<CREDIT_REQUEST MISMOVersionID="2.1">';                         
      $plist .= '<CREDIT_REQUEST_DATA'; 
      $plist .= ' CreditRequestID="CRReq0001"';
      $plist .= ' BorrowerID="BorRec0001"';
      $plist .= ' CreditReportRequestActionType="Submit"';
      $plist .= ' CreditReportType="Consumer"';
      $plist .= ' CreditRequestType="Individual">'; 
      $plist .= '<CREDIT_REPOSITORY_INCLUDED';
      $plist .= ' _EquifaxIndicator="N" _ExperianIndicator="Y"';
      $plist .= ' _TransUnionIndicator="N" />';
      $plist .= '</CREDIT_REQUEST_DATA>';     
      $plist .= '<LOAN_APPLICATION>';     
      $plist .= '<BORROWER BorrowerID="BorRec0001"';      
      $plist .= ' _FirstName="EVPAULA" _MiddleName=""';
      $plist .= ' _LastName="Consumer"';
      $plist .= ' _SSN="376988419">';
      $plist .= '<_RESIDENCE _StreetAddress="10655 Birch St"';         
      $plist .= ' _City="Burbank"';     
      $plist .= ' _State="CA" _PostalCode="20906" />';      
      $plist .= '</BORROWER>';
      $plist .= '</LOAN_APPLICATION>';
      $plist .= '</CREDIT_REQUEST>';
      $plist .= '</REQUEST_DATA>';      
      $plist .= '</REQUEST>';
           $plist .= '</REQUEST_GROUP>';
      echo "plist is $plist";
      die();
?>
 
What I am actually doing is sending plist out using curl as an xml string. But I've found when I echo plist is most of the data disappears
scriptah
Forum Commoner
Posts: 27
Joined: Sat Mar 15, 2008 8:58 pm
Location: Long Island, NY

Re: Variable values not appearing

Post by scriptah »

The output is perfectly fine.
If you want to really output it as an XML file, you suppose to call header( ) saying so ... or else the browser will display it as text/html.

Try adding:

Code: Select all

 
header('Content-Type: text/xml');
 
Before any output.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Variable values not appearing

Post by Zoxive »

michaelh613 wrote: What I am actually doing is sending plist out using curl as an xml string. But I've found when I echo plist is most of the data disappears
How are you looking at the data? Do a right click view source on the page. Also if you want it recongnized as xml, send a header in the start of the script.

Code: Select all

header ("content-type: text/xml")
Also if you are going to be doing more xml things with php i recommend looking at the PHP Xml Dom Functions / Classes.

simplexml
Dom Document
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: Variable values not appearing

Post by michaelh613 »

Zoxive wrote:
michaelh613 wrote: What I am actually doing is sending plist out using curl as an xml string. But I've found when I echo plist is most of the data disappears
How are you looking at the data? Do a right click view source on the page. Also if you want it recongnized as xml, send a header in the start of the script.

Code: Select all

header ("content-type: text/xml")
Also if you are going to be doing more xml things with php i recommend looking at the PHP Xml Dom Functions / Classes.

simplexml
Dom Document
I actually just echo'd the variable when file I sent by CURL wasn't recognized as CURL

Here is the full page. I'm not sure where I would put the Header

Code: Select all

 
<?php    
     /**      * Define POST URL and also payload     */    
      $test = '<BORROWER BorrowerID="BorRec0001"';
      $plist .= 
      $plist .= "<?xml version = \"1.0\"?>";
      $plist .= '<REQUEST_GROUP MISMOVersionID="2.1">';
      $plist .= '<REQUEST LoginAccountIdentifier="testuser"';
      $plist .= ' LoginAccountPassword="testpass">';
      $plist .= '<KEY _Name="MemberID" _Value="100"/>';           
      $plist .= '<REQUEST_DATA>'; 
      $plist .= '<CREDIT_REQUEST MISMOVersionID="2.1">';                         
      $plist .= '<CREDIT_REQUEST_DATA'; 
      $plist .= ' CreditRequestID="CRReq0001"';
      $plist .= ' BorrowerID="BorRec0001"';
      $plist .= ' CreditReportRequestActionType="Submit"';
      $plist .= ' CreditReportType="Consumer"';
      $plist .= ' CreditRequestType="Individual">'; 
      $plist .= '<CREDIT_REPOSITORY_INCLUDED';
      $plist .= ' _EquifaxIndicator="N" _ExperianIndicator="Y"';
      $plist .= ' _TransUnionIndicator="N" />';
      $plist .= '</CREDIT_REQUEST_DATA>';     
      $plist .= '<LOAN_APPLICATION>';     
      $plist .= '<BORROWER BorrowerID="BorRec0001"';      
      $plist .= ' _FirstName="EVPAULA" _MiddleName=""';
      $plist .= ' _LastName="Consumer"';
      $plist .= ' _SSN="376988419">';
      $plist .= '<_RESIDENCE _StreetAddress="10655 Birch St"';         
      $plist .= ' _City="Burbank"';     
      $plist .= ' _State="CA" _PostalCode="20906" />';      
      $plist .= '</BORROWER>';
      $plist .= '</LOAN_APPLICATION>';
      $plist .= '</CREDIT_REQUEST>';
      $plist .= '</REQUEST_DATA>';      
      $plist .= '</REQUEST>';
           $plist .= '</REQUEST_GROUP>';
      //echo "plist is $plist";
      //die();
      //$xmlplist =simplexml_load_string($plist); //Load it into an xml object
      //echo "xmlplist is $xmlplist <br>";
      //die();
define('XML_PAYLOAD', '$plist');    
define('XML_POST_URL','$url');            
/**     * Initialize handle and set options     */    
$ch = curl_init();     
curl_setopt($ch, CURLOPT_URL, XML_POST_URL);     
curl_setopt($ch, CURLOPT_USERPWD, 'userid:password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);     
curl_setopt($ch, CURLOPT_TIMEOUT, 4);     
curl_setopt($ch, CURLOPT_POSTFIELDS, XML_PAYLOAD); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //Don't verify ssl certificate
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));        
/**     * Execute the request and also time the transaction     */    
$start = array_sum(explode(' ', microtime()));    
$result = curl_exec($ch);     
$stop = array_sum(explode(' ', microtime()));    
$totalTime = $stop - $start;
/**     * Check for errors     */    
    if ( curl_errno($ch) ){        
        $result = 'cURL ERROR -> ' . curl_errno($ch) . ': ' . curl_error($ch);    
    } 
    else {        
        $returnCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);        
        switch($returnCode)
            {            
                case 200:                
                break;            
                default:                
                $result = 'HTTP ERROR -> ' . $returnCode;                
                break;        
            }    
         }
       
    /**     * Close the handle     */    
    curl_close($ch);        
    /**     * Output the results and time     */    
    echo 'Total time for request: ' . $totalTime . "\n";    
    echo $result;           
    /**     * Exit the script     */    
    exit(0);
?>
 
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: Variable values not appearing

Post by michaelh613 »

I've tried adding some headers but still having a problem. I tried printing instead of echoing the xml and received a different error which indicates a problem with my xml document

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Invalid at the top level of the document. Error processing resource 'http://agiledev.hopto.org/curltest4.php'. Line 1, Pos...

plist is <?xml version = "1.0"?><?xml version = "1.0"?><REQUEST_GROUP MISMOVersionID="2.1"><REQUEST Log...

Here is the updated version of the code

Code: Select all

 
<?php    
     /**      * Define POST URL and also payload     */    
      $plist = '<?xml version = "1.0"?>';
      $plist .= '<REQUEST_GROUP MISMOVersionID="2.1">';
      $plist .= '<REQUEST LoginAccountIdentifier="testuser"';
      $plist .= ' LoginAccountPassword="testpass">';
      $plist .= '<KEY _Name="MemberID" _Value="100"/>';           
      $plist .= '<REQUEST_DATA>'; 
      $plist .= '<CREDIT_REQUEST MISMOVersionID="2.1">';                         
      $plist .= '<CREDIT_REQUEST_DATA'; 
      $plist .= ' CreditRequestID="CRReq0001"';
      $plist .= ' BorrowerID="BorRec0001"';
      $plist .= ' CreditReportRequestActionType="Submit"';
      $plist .= ' CreditReportType="Consumer"';
      $plist .= ' CreditRequestType="Individual">'; 
      $plist .= '<CREDIT_REPOSITORY_INCLUDED';
      $plist .= ' _EquifaxIndicator="N" _ExperianIndicator="Y"';
      $plist .= ' _TransUnionIndicator="N" />';
      $plist .= '</CREDIT_REQUEST_DATA>';     
      $plist .= '<LOAN_APPLICATION>';     
      $plist .= '<BORROWER BorrowerID="BorRec0001"';      
      $plist .= ' _FirstName="EVPAULA" _MiddleName=""';
      $plist .= ' _LastName="Consumer"';
      $plist .= ' _SSN="376988419">';
      $plist .= '<_RESIDENCE _StreetAddress="10655 Birch St"';         
      $plist .= ' _City="Burbank"';     
      $plist .= ' _State="CA" _PostalCode="20906" />';      
      $plist .= '</BORROWER>';
      $plist .= '</LOAN_APPLICATION>';
      $plist .= '</CREDIT_REQUEST>';
      $plist .= '</REQUEST_DATA>';      
      $plist .= '</REQUEST>';
      $plist .= '</REQUEST_GROUP>';
      print "plist is $plist";
      die();
      //$xmlplist =simplexml_load_string($plist); //Load it into an xml object
      //echo "xmlplist is $xmlplist <br>";
      //die();
      $headers = get_curl_headers();
define('XML_PAYLOAD', '$plist');    
define('XML_POST_URL','url');            
/**     * Initialize handle and set options     */    
$ch = curl_init();     
curl_setopt($ch, CURLOPT_URL, XML_POST_URL);     
curl_setopt($ch, CURLOPT_USERPWD, 'userid:password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);     
curl_setopt($ch, CURLOPT_TIMEOUT, 4);     
curl_setopt($ch, CURLOPT_POSTFIELDS, XML_PAYLOAD); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //Don't verify ssl certificate
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));        
/**     * Execute the request and also time the transaction     */    
$start = array_sum(explode(' ', microtime()));    
$result = curl_exec($ch);     
$stop = array_sum(explode(' ', microtime()));    
$totalTime = $stop - $start;
/**     * Check for errors     */    
    if ( curl_errno($ch) ){        
        $result = 'cURL ERROR -> ' . curl_errno($ch) . ': ' . curl_error($ch);    
    } 
    else {        
        $returnCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);        
        switch($returnCode)
            {            
                case 200:                
                break;            
                default:                
                $result = 'HTTP ERROR -> ' . $returnCode;                
                break;        
            }    
         }
       
    /**     * Close the handle     */    
    curl_close($ch);        
    /**     * Output the results and time     */    
    echo 'Total time for request: ' . $totalTime . "\n";    
    echo $result;           
    /**     * Exit the script     */    
    exit(0);
    
    function get_curl_headers() {
      $headers = array();
      
      $headers[] = "Content-Type: text/xml"; //or maybe text/xml
      $headers[] = "X-VPS-Timeout: 30";
      $headers[] = "X-VPS-VIT-OS-Name: Windows 2003 Server";  // Name of your OS
      $headers[] = "X-VPS-VIT-OS-Version: RHEL 4";  // OS Version
      $headers[] = "X-VPS-VIT-Client-Type: PHP/cURL";  // What you are using
      $headers[] = "X-VPS-VIT-Client-Version: 0.01";  // For your info
      $headers[] = "X-VPS-VIT-Client-Architecture: x86";  // For your info
      $headers[] = "X-VPS-VIT-Integration-Product: MyApplication";  // For your info, would populate with application name
      $headers[] = "X-VPS-VIT-Integration-Version: 0.01"; // Application version    
      
      return $headers;  
    }
?>
 
 
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Variable values not appearing

Post by Zoxive »

michaelh613 wrote: Here is the updated version of the code
Uh line 36 you call die(); meaning it stops execution of the script.

The data you are posting is in XML Format? If this is the case it is most likely bound to a name.

xmlData=$plist (Depends on the specs of the Service you are using to submit to using curl)
michaelh613 wrote:plist is <?xml version = "1.0"?><?xml version = "1.0"?><REQUEST_GROUP MISMOVersionID="2.1"><REQUEST Log...
Also doesn't make any since. Why is there 2 opening tags for xml. In your code you only have one.
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: Variable values not appearing

Post by michaelh613 »

Zoxive wrote:
michaelh613 wrote: Here is the updated version of the code
Uh line 36 you call die(); meaning it stops execution of the script.

The data you are posting is in XML Format? If this is the case it is most likely bound to a name.

xmlData=$plist (Depends on the specs of the Service you are using to submit to using curl)
michaelh613 wrote:plist is <?xml version = "1.0"?><?xml version = "1.0"?><REQUEST_GROUP MISMOVersionID="2.1"><REQUEST Log...
Also doesn't make any since. Why is there 2 opening tags for xml. In your code you only have one.

The die was in there to just stop execution during testing so I could send . The duplication has been removed and problem not removed.
I'm not sure what you mean by binding data to a name. I am submtting it as xml.

On a related note I've been playing with trying to create xml using DOM because its been suggested to me that is a better way to create it. I've created based on Oreilly's PHP cookbook the following code to create xml and parse the string

Code: Select all

 
<?php
$dom = new DOMDocument('1.0');
 
//create root element <book> and append it to the document
$book = $dom->appendChild($dom->createElement('book'));
 
//Create the title element and append it to $book
$title=$book->appendChild($dom->createElement('title'));
$title->setAttribute('cover','soft');
 
//create and append author elements to book
$sklar=$book->appendChild($dom->createElement('author'));
//create and append the text for each element
$sklar->appendChild($dom->createTextNode('Sklar'));
 
$trachtenburg=$book->appendChild($dom->createElement('author'));
$trachtenburg->appendChild($dom->createTextNode('Trachtenburg'));
 
$dom -> formatOutput = true;
$result= $dom->saveXML();
echo $result;
 
$sx =simplexml_load_string('$result');
foreach ($sx->book as $book){
    $author_text_value = $book->author;
    
    print "author_text_value<br>";
}
?>
 
However while the xml appears to be created correctly (when I view it using view source) an attempt to print it out to the browser in the code gives the error in view source
 
b>Warning</b>:  simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: Entity: line 1: parser error : Start tag expected, '<' not found in <b>C:\localpath</b> on line <b>23</b><br />
<br />
<b>Warning</b>:  simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: $result in <b>C:\localpath</b> on line <b>23</b><br />
<br />
<b>Warning</b>:  simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: ^ in <b>C:\localpath</b> on line <b>23</b><br />
<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>C:\localpath</b> on line <b>24</b><br />
 
 
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Variable values not appearing

Post by RobertGonzalez »

Writing an XML is probably easier just by plain jain echoing out the data.

Is there somewhere we can hit the script in action to see its output?
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: Variable values not appearing

Post by michaelh613 »

Here is how I am creating the xml at this time using dom.

Code: Select all

 
<?php
$dom = new DOMDocument('1.0');
//create root element <book> and append it to the document
$REQUEST_GROUP = $dom->appendChild($dom->createElement('REQUEST_GROUP'));
$REQUEST_GROUP->setAttribute('MISMOVersionID','2.1');
 
$REQUEST=$REQUEST_GROUP->appendChild($dom->createElement('REQUEST'));
$REQUEST->setAttribute('LoginAccountIdentifier','testuser');
 
$KEY=$REQUEST->appendChild($dom->createElement('KEY'));
$KEY->setAttribute('_NAME','MemberID');
$KEY->setAttribute('_Value','100');
 
$REQUEST_DATA=$REQUEST->appendChild($dom->createElement('REQUEST_DATA'));
$CREDIT_REQUEST=$REQUEST_DATA->appendChild($dom->createElement('CREDIT_REQUEST'));
$CREDIT_REQUEST->setAttribute('MISMOVersionID','2.1');
 
$CREDIT_REQUEST_DATA=$CREDIT_REQUEST->appendChild($dom->createElement('CREDIT_REQUEST_DATA'));
$CREDIT_REQUEST_DATA->setAttribute('CreditRequestID','CRReq0001');
$CREDIT_REQUEST_DATA->setAttribute('BorrowerID','BorRec0001');
$CREDIT_REQUEST_DATA->setAttribute('CreditReportRequestActionType','Submit');
$CREDIT_REQUEST_DATA->setAttribute('CreditReportType','Consumer');
$CREDIT_REQUEST_DATA->setAttribute('CreditRequestType','Individual');
 
$CREDIT_REPOSITORY_INCLUDED=$CREDIT_REQUEST_DATA->appendChild($dom->createElement('CREDIT_REPOSITORY_INCLUDED'));
$CREDIT_REPOSITORY_INCLUDED->setAttribute('_EquifaxIndicator','N');
$CREDIT_REPOSITORY_INCLUDED->setAttribute('_ExperianIndicator','Y');
$CREDIT_REPOSITORY_INCLUDED->setAttribute('_TransUnionIndicator','N');
 
$LOAN_APPLICATION=$CREDIT_REQUEST->appendChild($dom->createElement('LOAN_APPLICATION'));
$BORROWER=$LOAN_APPLICATION->appendChild($dom->createElement('BORROWER'));
$BORROWER->setAttribute('BorrowerID','BorRec0001');
$BORROWER->setAttribute('_FirstName','EVPAULA');
$BORROWER->setAttribute('_MiddleName','');
$BORROWER->setAttribute('_LastName','Consumer');
$BORROWER->setAttribute('_SSN','376988419');
 
 
$_RESIDENCE=$BORROWER->appendChild($dom->createElement('_RESIDENCE'));
$_RESIDENCE->setAttribute('_StreetAddress','10655 Birch St');
$_RESIDENCE->setAttribute('_City','Burbank');
$_RESIDENCE->setAttribute('_State','Ca');
$_RESIDENCE->setAttribute('_PostalCode','20906');
 
$dom -> formatOutput = true;
$result= $dom->saveXML();
//echo $result;
 ?>
 
I am still getting an error when I post it (I am getting a null returned). I'm trying to figure out is the issue with my post with curl not including information needed to define this as a xml document or a problem with the xml document itself or of course a problem with the server I am sending the info to.

Here is the php curl code

Code: Select all

 
<?php    
     /**      * Define POST URL and also payload     */     
     
      require 'createxml.php';       
      $headers = get_curl_headers();
define('XML_PAYLOAD', '$result');    
define('XML_POST_URL','$url');            
/**     * Initialize handle and set options     */    
$ch = curl_init();     
curl_setopt($ch, CURLOPT_URL, XML_POST_URL);     
curl_setopt($ch, CURLOPT_USERPWD, '$userid:$password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);     
curl_setopt($ch, CURLOPT_TIMEOUT, 4);     
curl_setopt($ch, CURLOPT_POSTFIELDS, XML_PAYLOAD); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //Don't verify ssl certificate
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));        
/**     * Execute the request and also time the transaction     */    
$start = array_sum(explode(' ', microtime()));    
$result = curl_exec($ch);     
$stop = array_sum(explode(' ', microtime()));    
$totalTime = $stop - $start;
/**     * Check for errors     */    
    if ( curl_errno($ch) ){        
        $result = 'cURL ERROR -> ' . curl_errno($ch) . ': ' . curl_error($ch);    
    } 
    else {        
        $returnCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);        
        switch($returnCode)
            {            
                case 200:                
                break;            
                default:                
                $result = 'HTTP ERROR -> ' . $returnCode;                
                break;        
            }    
         }
       
    /**     * Close the handle     */    
    curl_close($ch);        
    /**     * Output the results and time     */    
    echo 'Total time for request: ' . $totalTime . "\n";    
    echo $result;           
    /**     * Exit the script     */    
    exit(0);
    
    function get_curl_headers() {
      $headers = array();
      
      $headers[] = "Content-Type: text/xml"; //or maybe text/xml
      $headers[] = "X-VPS-Timeout: 30";
      $headers[] = "X-VPS-VIT-OS-Name: Windows 2003 Server";  // Name of your OS
      $headers[] = "X-VPS-VIT-OS-Version: RHEL 4";  // OS Version
      $headers[] = "X-VPS-VIT-Client-Type: PHP/cURL";  // What you are using
      $headers[] = "X-VPS-VIT-Client-Version: 0.01";  // For your info
      $headers[] = "X-VPS-VIT-Client-Architecture: x86";  // For your info
      $headers[] = "X-VPS-VIT-Integration-Product: MyApplication";  // For your info, would populate with application name
      $headers[] = "X-VPS-VIT-Integration-Version: 0.01"; // Application version    
      
      return $headers;  
    }
?>
 
 
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Variable values not appearing

Post by RobertGonzalez »

Your defines in this case are going to be killing you. What is the value of $url? And these:

Code: Select all

<?php
define('XML_PAYLOAD', '$result');    
define('XML_POST_URL','$url'); 
?>
Mean the the constants are being assigned the literal values '$result' and '$url' not the parsed values of these vars.
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: Variable values not appearing

Post by michaelh613 »

Everah wrote:Your defines in this case are going to be killing you. What is the value of $url? And these:

Code: Select all

<?php
define('XML_PAYLOAD', '$result');    
define('XML_POST_URL','$url'); 
?>
Mean the the constants are being assigned the literal values '$result' and '$url' not the parsed values of these vars.
actually url in my real code as well and the user id and password are hard coded in. I just put those in for security reasons because I don't wnt to make my real user ids passwords and urls available on the public internet. I did pick up on the problem with result and removed the single quotes around it.

$result comes from require 'createxml.php'; that is required at the beginning of the page.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Variable values not appearing

Post by RobertGonzalez »

So did those changes make any difference?
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: Variable values not appearing

Post by michaelh613 »

Everah wrote:So did those changes make any difference?
Nope. Thats why I am so frustrated. I really leading towards curl being the issue now.
Post Reply