473,378 Members | 1,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

PHP - XML Request without PEAR

I've been doing PHP for 6 years now and can write most systems in a few days, but I have never looked into XML much, even though I know I should.

Here is my problem :

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $url = "http://www.e-travelsolution.com/xml/xmlpostreceiver1-0.asmx/ET_SO_HT_001";
  4. $data = "<?xml version='1.0' encoding='utf-8' ?>
  5. <Request Type='List' Version='1.0'> {List, Reservation, Content}
  6. <Header>
  7. <Product>Hotel</Product>
  8. <Affiliate_Id>test</Affiliate_Id>
  9. <Request_Id>test".time()."</Request_Id>
  10. <Timestamp>".date("Y-m-d",time())."T".date("H:i:s")."</Timestamp>
  11. <Language>ING</Language>
  12. <Currency>US</Currency>
  13. </Header>
  14. <ArrivalDate></ArrivalDate>
  15. <ReturnDate></ReturnDate>
  16. <Destination></Destination>
  17. <MealPlan></MealPlan>
  18. <Category></Category>
  19. <City></City>
  20. <Hotel_Name></Hotel_Name>
  21. <Max></Max>
  22. <New>No</New>
  23. <Inmediate_Conf>YES</Inmediate_Conf>
  24. <Text>YES</Text>
  25. <Order_Id>".$_GET['order_by']."</Order_Id>
  26. <Order_Di>".$_GET['ascdesc']."</Order_Di>
  27. </Request>";
  29. $req =& new HTTP_Request($url);
  30. $req->addHeader("Content-Type", "text/xml");
  31. $req->addHeader("Content-Length", strlen($data));
  32. $req->setMethod(HTTP_REQUEST_METHOD_POST);
  33. $req->addRawPostData($data, true);
  34. $req->sendRequest();
  35. echo $req->getResponseBody();
  37. ?>
This gives me : Fatal error: Cannot instantiate non-existent class: http_request in /u/t/travyuc/www.travelyucatan.com/hotels_list.php on line 29


Any help would be appreciated. I am trying to get an XML response from the XML posted submission. Their specific instructions were to post an XML request to generate an XML response.
Feb 4 '08 #1
7 7129
Well pear isn't installed so that kinda sucks. Any other way to post an XML request?
Feb 4 '08 #2
2,057 Expert 2GB
Not sure why you can't just install/enable pear. Anyways:
Feb 4 '08 #3
So, I got the host to install the pear modules i needed, but now i am getting an error instead of a response. Here is the code I have :


$url = "http://www.e-travelsolution.com/xml/xmlpostreceiver1-0.asmx/ET_SO_HT_001";

$data = "<?xml version='1.0' encoding='utf-8' ?>
<Request Type='List' Version='1.0'>

require 'HTTP/Request.php';
$req =& new HTTP_Request($url);
$req->addHeader("Content-Type", "text/xml");
$req->addHeader("Content-Length", strlen($data));
$req->addRawPostData($data, true);
echo $req->getResponseBody();

Feb 5 '08 #4
2,057 Expert 2GB
What is the error? It would help to find the problem.
Feb 6 '08 #5
This is the error :

Expand|Select|Wrap|Line Numbers
  1. Error #0: Pag: www.e-travelsolution.com PEAR HTTP_Request class ( http://pear.php.net/ ) Originado por: .getDataReader  91  Object reference not set to an instance of an object.  IPDMCZ0431MIA
Feb 7 '08 #6
2,057 Expert 2GB
What version of PHP are you using? Many of these problems are associated with PHP before 4.2
Feb 7 '08 #7
I'm using version 4.2.3.

I know there are earlier versions, but the error seems to be coming from their end. I am at least getting some sort of response. I am just wondering what the error means so maybe I can fix it from my end.
Feb 8 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Sandro Dentella | last post by:
I need to use a class to handle mbox files that uses PEAR. Since I'm using Debian (both woody and, I simply apt-get(ed) php4-pear but I can't use it becouse I get the error: Warning: dl():...
by: DJ Majestik | last post by:
OK, I am new to the whole PEAR/Smarty templating thing. I am trying to setup my directory structure correctly. If someone could weigh in and see if I have this setup "right", I would appreciate it....
by: Alan Prescott | last post by:
I'm running SuSE Linux 9.3, fully up to date running # pear install db responds with ... downloading DB-1.7.6.tgz ... Starting to download DB-1.7.6.tgz (124,807 bytes)...
by: Jim Michaels | last post by:
I downloaded a PEAR module, but it came with this XML file and a PHP file. I figure I just include the PHP file somehow, but what do I do with the XML file?
by: bwhitehd | last post by:
I'm having a problem installing php. The compile seems to go fine, but when it gets to the install step I get the following errors. Does anyone have an idea of what might be the problem? We...
by: IchBin | last post by:
I am new to PHP and I am running on Windoze XP SP 2. Just noticed that the PEAR installed dir structure I have (to DB subdir) is : C:\php5.2\PEAR\pear\DB My registry vars are:...
by: Nichu | last post by:
Hello Lately I started to "bravely fight" with Postfix + Squirrelmail everything works great (PHP also :)) but I want to have possibility to change passwords (from MySql database) through the...
by: IchBin | last post by:
I remember having problems with pear when I first installed it but got it running some time ago. This is on a windoze XP SP OS. I did not think it was correct because it pointed to...
by: daralthus | last post by:
Hello! I would like to ask your help, i have founded a great code here: http://www.jamescaws.co.uk/2008/07/dynamically-count-exit-link-clicks-throughs-using-javascript-php/ but it uses Pear DB...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.