string with dollar symbol in url parameters in php
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
when I try to open the url using any functions fopen or curl in php,
the xml is not returned. The problem I found out was the searchid string in the above url i.e searchid=GR$GrIF0BYUcRqSIWXRiPA.
It has a "$" character in the string .So php is interpreting the "$" sign as new variable rather than a string and returning improper results.
function Results($SessionId,$SearchId)
{
global $flightData;
echo "<BR>";
$flighturl = "http://www.k.com/s/basic/flight?searchid=$SearchId&c=10&apimode=1&_sid_=$SessionId";
echo $flighturl;
echo "<BR>";
echo "<a href=$flighturl>Click on the URL to see Flight results</a>";
MagicParser_parse($flighturl,"flightHandler","xml|SEARCHRESULT/");
}
The $SessionId and $SearchId will have values that are randomly generated by the API; For Ex:
Session Id is 14-fqRZ8_QO4ScJF$RuXvdR
Search Id is eu$iI8$XOKQiTi8_p1DT_Q
both of them may randomly have $ string randomly appearing every time I call the API.
So I am unable to send the exact sessionid value as
function Results($SessionId,$SearchId)
{
global $flightData;
echo "<BR>";
$flighturl = "http://www.k.com/s/basic/flight?searchid=$SearchId&c=10&apimode=1&_sid_=$SessionId";
echo $flighturl;
echo "<BR>";
echo "<a href=$flighturl>Click on the URL to see Flight results</a>";
MagicParser_parse($flighturl,"flightHandler","xml|SEARCHRESULT/");
}
The $SessionId and $SearchId will have values that are randomly generated by the API; For Ex:
Session Id is 14-fqRZ8_QO4ScJF$RuXvdR
Search Id is eu$iI8$XOKQiTi8_p1DT_Q
both of them may randomly have $ string randomly appearing every time I call the API.
So I am unable to send the exact sessionid value as generated by the API
The url doesnt have a XML file.. It is a API that returns an XML on opening the url in browser
and I have to grab that xml data to display them in html.
How are you displaying the xml? a simple echo? Are you sending xml headers? For instance, if I leave out the "header(...)" line, the following will not return proper xml data, even though if you view the source of the resulting page, it's perfect xml.
to reiterate... without the "header()" line, the above does not return proper a proper xml document even though the text it does return is proper xml. With the "header()" line, it works perfectly.
edit:
hmm... re-read your question. I don't think I answered it.
Sorry, I don't have a good answer, but I'll leave this here for the record.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.