Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
HttpException and undefined property when POST XML using pecl
Old 08-12-2008, 09:44 PM HttpException and undefined property when POST XML using pecl
Novice Talker

Posts: 14
Name: Orion Tiller
Trades: 0
Can anyone see why I would be receiving these and the HTTP POST not working correctly? Any help would be greatly appreciated.

I get this notice in my server logs and then I also get an exception

PHP Notice: Undefined property: HttpRequest::$rrequestBody in /var/www/vhosts/domain.com/httpdocs/homewarranty/warranty_test_post.php on line 103


exception 'HttpRequestException' with message 'server returned nothing (no headers, no data); Empty reply from server (http://wwwstage.postdomain.com/partn...wshRequest.jsp)' in /var/www/vhosts/domain.com/httpdocs/homewarranty/warranty_test_post.php:107 Stack trace: #0 /var/www/vhosts/domain.com/httpdocs/homewarranty/warranty_test_post.php(107): HttpRequest->send() #1 {main}


Here is the code I'm using

PHP Code:
<?php


$lead 
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE wshRequest SYSTEM \"http://wwwstage.postdomain.com/DTD/wshRequest.dtd\">

<wshRequest>
  <type>Order</type> 
  <proxyUserId>xmlGSM</proxyUserId> 
  <partner>
  <name>DirectAgents</name> 
  <uniqueId>58A0AB51-CBDA-4F36-B071-257AA3171DC1</uniqueId> 
     <password>PASSWORD</password> 
  </partner>
  <customer>
  <firstName>Susan</firstName> 
  <lastName>Brown</lastName> 
  <email>SusanBrownTest2@yahoo.com</email> 
  </customer>
  <serviceAddress>
  <addressLine1>1234 SusanBrown Avenue</addressLine1> 
  <city>Chicago</city> 
  <state>IL</state> 
  <zip>60208</zip> 
  <firstName>Susan</firstName> 
  <lastName>Brown</lastName> 
  <phone1area>714</phone1area> 
  <phone1exch>999</phone1exch> 
  <phone1suffix>2000</phone1suffix> 
  </serviceAddress>
  <order>
  <item>
  <productName>Home Warranty Lead</productName> 
  <property>
  <name>adName</name> 
  <value>DAMicrosite_GSM</value> 
  </property>
  <property>
  <name>oiPropLeadPlacementBrand</name> 
  <value>AH</value> 
  </property>
  <property>
  <name>oiPropResponseVehicle</name> 
  <value>online</value> 
  </property>
  <property>
  <name>oiPropResultsEntity</name> 
  <value>NCD</value> 
  </property>
  </item>
  </order>
  </wshRequest>"
;
                                                                            
$headers = array( "Content-Type" => "text/xml""Content-Length" => mb_strlen($lead'8bit'));            
$url "http://wwwstage.postdomain.com/partnerInterface/wshRequest.jsp?";
$req = new HttpRequest($urlHttpRequest::METH_POST);
$req->addHeaders($headers);
$req->setContentType"text/xml" );
$req->addRawPostData($lead);

try {
    
$body $req->send()->getBody();
} catch (
HttpException $ex) {
    echo 
"\nEXCEPTION:".$ex;
}

    echo( 
"\n".$body ); 

?>

Last edited by otiller; 08-12-2008 at 11:01 PM..
otiller is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-13-2008, 02:29 AM Re: HttpException and undefined property when POST XML using pecl
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I don't know this module, but are you sure you don't have a syntax error here:
PHP Code:
 $req = new HttpRequest($urlHttpRequest::METH_POST); 
Because METH_POST sounds a bit too much like a drug to me.
PHP Code:
 $req = new HttpRequest($urlHttpRequest::METHOD_POST); 
would seem more correct, but again, I never used that pecl module.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 08-13-2008, 02:36 AM Re: HttpException and undefined property when POST XML using pecl
Novice Talker

Posts: 14
Name: Orion Tiller
Trades: 0
I don't think so I got it from here.

http://www.php.net/manual/en/functio...quest-send.php

but I was able to figure it out using a different method.

PHP Code:
   $url "http://wwwstage.domainname.com/partnerInterface/wshRequest.jsp";   
  
$leadheaders = array( "Content-Type" => "text/xml");  
     
$params = array('http' => array(
                  
'method' => 'POST',
                  
'content' => $lead
               
));
     
     
$params['http']['header'] = $leadheaders;
     
     
$ctx stream_context_create($params);
     
$fp = @fopen($url'rb'false$ctx);
     if (!
$fp) {
        throw new 
Exception("Problem with $url$php_errormsg");
     }
     
$response = @stream_get_contents($fp); 
     echo 
$response
otiller is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to HttpException and undefined property when POST XML using pecl
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12213 seconds with 12 queries