View Full Version : Parsing a URL with Brackets
clasione 05-20-2005, 07:48 AM I'm trying to parse a url with Brackets:
http://xml.traveltoday.net/xmlhotel.jsp?xml=<HotelRequest%20method="runHotelInfoListRequest">
<HotelInfoListRequest><City>Springfield</City>
<StateProvince>MO</StateProvince><Country>US</Country>
<dataSetRequested>COMPLETE</dataSetRequested>
</HotelInfoListRequest></HotelRequest>
with Carp RSS....
If you copy that URL into a browser it will dislay a feed, butu Carp RSS and PHP isn't working with that link....
How can I change this type of link and make it parse with a feed?
Anyone know?
error404 05-20-2005, 08:44 AM If you copy it to a browser, it will be encoded first before it is sent. Many of those characters are not valid in URLs. This is probably your problem.
Try calling urlencode() on the string before passing it to be fetched.
clasione 05-20-2005, 08:50 AM very interesting... I'm looking at this:
http://www.4guysfromrolla.com/demos/Server.UrlEncode.asp
Can you be more specific on how to use urlencode?
clasione 05-20-2005, 08:58 AM This is what I've got so far:
Warning: urlencode() expects exactly 1 parameter, 0 given in /home/floridav/public_html/zhotel-reservations.php on line 73
error404 05-20-2005, 06:20 PM You'd want to do something like this:
$url = 'http://xml.traveltoday.net/xmlhotel.jsp?xml=<HotelRequest method="runHotelInfoListRequest">';
$url = urlencode($url);
clasione 05-20-2005, 11:36 PM What about the rest of the string?
<HotelInfoListRequest><City>Springfield</City>
<StateProvince>MO</StateProvince><Country>US</Country>
<dataSetRequested>COMPLETE</dataSetRequested>
</HotelInfoListRequest></HotelRequest>
Would that go in there aswell?
error404 05-21-2005, 02:48 AM Yes, any string can be urlencoded. Keep in mind that I believe there's a request size limit (read the RFC to check, I'm not sure what it is or that it exists...)
Also just for semantics, parsing is collecting useful information *from* a string, this is something else (encoding..).
clasione 05-21-2005, 02:58 AM Thanks a bundle... I'll try this and let you know how I make out....
clasione 05-21-2005, 03:08 AM ok so check it out, this is what I've got.....
<?php
require_once 'carp/carp.php';
CarpCacheShow('http://www.floridavisiting.com/hotels.php');
?>
Inside hotels.php I have:
<?php
$url = 'http://xml.traveltoday.net/xmlhotel.jsp?xml=<HotelRequest%20method="runHotelInfoListRequest">
<HotelInfoListRequest><City>Springfield</City>
<StateProvince>MO</StateProvince><Country>US</Country>
<dataSetRequested>COMPLETE</dataSetRequested>
</HotelInfoListRequest></HotelRequest>';
$url = urlencode($url);
?>
How does that look, cause it aint workin?
clasione 05-26-2005, 03:43 PM I still can't get this damb thing to work, anyone else willing to help me out with this?
*** Whoever helps me get this working:
I am willing to give you full rights to the domain name
http://www.blazingwebhosting.com
The Prohacker 05-26-2005, 03:47 PM Originally posted by clasione
I still can't get this damb thing to work, anyone else willing to help me out with this?
Try this for a URL
http://xml.traveltoday.net/xmlhotel.jsp?xml=%3CHotelRequest%20method=%22runHotelInfoListRequest%22%3E%3CHotelInfoListRequest%3E%3CCity%3ESpringfield%3C/City%3E%3CStateProvince%3EMO%3C/StateProvince%3E%3CCountry%3EUS%3C/Country%3E%3CdataSetRequested%3ECOMPLETE%3C/dataSetRequested%3E%3C/HotelInfoListRequest%3E%3C/HotelRequest%3E
ZiDev 05-26-2005, 03:49 PM I really wouldn't pass all that information through a URL. I'd either store it in a cookie or multiple <input type="hidden"> with a POSTed form.
-- HW
clasione 05-26-2005, 04:01 PM http://www.floridavisiting.com/zhotel-reservations.php
ok, I tryed that long url, didn't work....
<?php
require_once 'carp/carp.php';
CarpCacheShow('http://xml.traveltoday.net/xmlhotel.jsp?xml=%
3CHotelRequest%20method=%22runHotelInfoListRequest%22%
3E%3CHotelInfoListRequest%3E%3CCity%3ESpringfield%
3C/City%3E%3CStateProvince%3EMO%3C/StateProvince%3E%3CCountry%3EUS%3C/Country
%3E%3CdataSetRequested%3ECOMPLETE%3C/dataSetRequested%3E%3C/HotelInfoListRequest
%3E%3C/HotelRequest%3E');
?>
you'll notice that on the home page, the feeds are working, so it's just a matter of getting a moe valid url for CARP to use....
___
ps, try and cut that post in half, it stretching this thread all over..
|