PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old October 22nd, 2009, 04:20 AM
Smoothas Smoothas is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 4 Smoothas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 34 sec
Reputation Power: 0
NEWBIE-Help NEEDED-Fatal error: Call to undefined method HTTP_Request::getMessage()

Hello,

I've written my first PHP webpage, but I'm getting the following error when running it :-

Fatal error: Call to undefined method HTTP_Request::getMessage() in /htdocs/hidden/test/d2xml.php on line 250

Line 250 reads :-
echo $req->getMessage();

I think I am not declaring ( properly or at all ) the right php module in my "required_once" section.
Please can someone help me ( rest of code as follows ) :-

>>>>>>> CODE for D2XML.php <<<<<<<<<<
[PHP]
<?php
set_include_path('.://htdocs/PEAR/');
/*include('/htdocs/PEAR/HTTP/Request.php');*/
require_once "/htdocs/PEAR/HTTP/Request.php";
require_once "/htdocs/PEAR/PEAR.php";
PEAR::setErrorHandling(PEAR_ERROR_DIE);

if(isset($_POST['create_xml'])){

echo "Links Data Posted";

/* All Links data from the form is now being stored in variables in string format */

$firstName = $_POST['firstName'];

$lastName = $_POST['lastName'];

$address1 = $_POST['address1'];

$address2 = $_POST['address2'];

$streetnumber = $_POST['streetnumber'];

$title = $_POST['title'];

$postcode = $_POST['postcode'];

$country = $_POST['country'];

$since = $_POST['since'];

$passdrive = $_POST['passdrive'];

$refno = $_POST['refno'];

$CrqDateTime=str_replace('%',substr(microtime(),2, 7),date('Y-m-d\TH:i:s.%O'));

$CrqDateTime=substr($CrqDateTime,0,-2).':'.substr($CrqDateTime,-2);

$CrqDocName=str_replace('%',substr(microtime(),2,7 ),date('Y-m-d\TH-i-s-%O'));

$CrqDocName=substr($CrqDocName,0,-2).'-'.substr($CrqDocName,-2);

$urlDoc = $CrqDocName;

$url = "URL";

$CrqTestRequest = "Test";

$CrqService = "Identity";

$CrqCompanyID = "CompID";

$CrqUserID = "myID";

$CrqSearchID = "SID0001";

$CrqPassword = "ac0524";

$CrqClientRef = "TESTREF0001";

$xmlBeg1 = '<?xml version="1.0" encoding="utf-8"?>';

$xmlBeg2 = '<soap:Envelope xmlnsds="URL" ;

xmlnssi="URL";
xmlns:soap="URL";

$xmlBeg4 = '<PerformCheck xmlns="URL)">';

$CrqIntegratorID ="E659FE11-D469-426B-A87C-7AC222651A37";

$xml_document= $xmlBeg1;

$xml_document .= $xmlBeg2;

$xml_document .= "<soap:Body>";

$xml_document .= $xmlBeg4;

$xml_document .= "<CallRequest>";

$xml_document .= "<CrqIntegratorId>";

$xml_document .= $CrqIntegratorID;

$xml_document .= "</CrqIntegratorId>";

$xml_document .= "<CrqTestRequest>";

$xml_document .= $CrqTestRequest;

$xml_document .= "</CrqTestRequest>";

$xml_document .= "<CrqDateTime>";

$xml_document .= $CrqDateTime;

$xml_document .= "</CrqDateTime>";

$xml_document .= "<CrqService>";

$xml_document .= $CrqService;

$xml_document .= "</CrqService>";

$xml_document .= "<CrqCompanyID>";

$xml_document .= $CrqCompanyID;

$xml_document .= "</CrqCompanyID>";

$xml_document .= "<CrqUserID>";

$xml_document .= $CrqUserID;

$xml_document .= "</CrqUserID>";

$xml_document .= "<CrqPassword>";

$xml_document .= $CrqPassword;

$xml_document .= "</CrqPassword>";

$xml_document .= "<CrqSearchId>";

$xml_document .= $CrqSearchID;

$xml_document .= "</CrqSearchId>";

$xml_document .= "<CrqClientRef>";

$xml_document .= $CrqClientRef;

$xml_document .= "</CrqClientRef>";

$xml_document .= "<CrqApplicant>";

$xml_document .= "<AptName>";

$xml_document .= "<Surname>";

$xml_document .= $lastName;

$xml_document .= "</Surname>";

$xml_document .= "<Forename>";

$xml_document .= $firstName;

$xml_document .= "</Forename>";

$xml_document .= "<Title>";

$xml_document .= $title;

$xml_document .= "</Title>";

$xml_document .= "</AptName>";

$xml_document .= "<AptAddress>";

$xml_document .= "<AadBuilding>";

$xml_document .= $streetnumber;

$xml_document .= "</AadBuilding>";

$xml_document .= "<AadStreet>";

$xml_document .= $address1;

$xml_document .= "</AadStreet>";

$xml_document .= "<AadPostTown>";

$xml_document .= $address2;

$xml_document .= "</AadPostTown>";

$xml_document .= "<AadPostCode>";

$xml_document .= $postcode;

$xml_document .= "</AadPostCode>";

$xml_document .= "</AptAddress>";

$xml_document .= "</CrqApplicant>";

$xml_document .= "</CallRequest>";

$xml_document .= "</PerformMLCheck>";

$xml_document .= "</soap:Body>";

$xml_document .= "</soap:Envelope>";

$doc_document= $title;

$doc_document .= $firstName;

$doc_document .= $lastName;

$doc_document .= $streetnumber;

$doc_document .= $address1;

$doc_document .= $address2;

$doc_document .= $postcode;

$doc_document .= $country;

$path_dir = "output/";

$doc_path_dir = "output/";

$path_dir .= $urlDoc .".xml";

$doc_path_dir .= $urlDoc .".doc";

/* Data in Variables ready to be written to an XML file */

$fp = fopen($path_dir,'w');

$write = fwrite($fp,$xml_document);
fclose($fp);

/* Data in Variables ready to be written to an DOC file */

$fp = fopen($doc_path_dir,'w+');

$write = fwrite($fp,$doc_document);
fclose($fp);


echo ". File to be sent to AML is called " .$path_dir;
ini_set('display_errors', 1);
error_reporting(E_ALL);
/* Send File */
/*$req =& new HTTP_Request($url, HTTP_METH_POST);*/
$req =& new HTTP_Request($url);
$req->setMethod(HTTP_REQUEST_METHOD_POST);
$req->addHeader('POST',' /Webfile.asmx HTTP/1.1');
$req->addHeader('Host','ws.hostepage.co.uk');
$req->addHeader('Content-Type','text/xml; charset=utf-8');
$req->addHeader('ContentLength',strlen($xml_document));
$req->addHeader('SOAPAction','"URL"');
$req->addFile('file_upload_field', $path_dir , 'application/xml');
$req->sendRequest();
echo $req->getResponseBody();
echo $req->getMessage(); <- LINE CAUSING ERROR
/* Send File */

ini_set('display_errors', 1);
error_reporting(E_ALL);

$result = $req->addFile('file_upload_field', $path_dir , 'application/xml');
if (PEAR::isError($result)) {
echo $result->getMessage();
} else {

$response = $req->sendRequest();
echo". Response is:" . $response;
if (PEAR::isError($response)) {
echo("<p>" . $response->getMessage() . "</p>");
} else {
echo $req->getResponseBody();
}
}


}


?>
[PHP]
Thanks in advance

Reply With Quote
  #2  
Old October 22nd, 2009, 03:25 PM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 172 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 2 m
Reputation Power: 3
There is no getMessage() in HTTP_Request:
http://pear.php.net/package/HTTP_Request/docs/latest/HTTP_Request/HTTP_Request.html

Are you maybe wanting to check for errors? If a variable is an instance of PEAR_Error, getMessage() will be available there.

Reply With Quote
  #3  
Old October 23rd, 2009, 11:51 AM
Smoothas Smoothas is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 4 Smoothas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 34 sec
Reputation Power: 0
Thats great. Thank you for the help.


Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > NEWBIE-Help NEEDED-Fatal error: Call to undefined method HTTP_Request::getMessage()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek