开发者

How do I get the URL returned using ColdFusion

开发者 https://www.devze.com 2023-01-23 22:42 出处:网络
I am accessing a set of websites using variables <cfhttp url=\"http://website.com/index.php?title=#var1#:#var2#&action=edit##EditPage\" method=\"GET\">

I am accessing a set of websites using variables

<cfhttp url="http://website.com/index.php?title=#var1#:#var2#&action=edit##EditPage" method="GET">

Some pages do not provide the data I need and instead of #EditPage in the URL show a fragment edit&redlink=1. I want to treat开发者_开发知识库 these pages differently. How do I go about identifying them?


The hash "#" used in URL is used by browsers and not servers. Typically when a browser sees the hash in the URL it will jump to either an anchor on the page with the same name, or an element with that id. Exceptions, are when javascript is used to modify the page dynamically based on the hash.


If I'm understanding you correctly, what you want to do is construct the URL in a separate variable first. Something like URLtoGet. Then, you can use cfif to switch on whether that constructed URL contains the fragment you specified. Look into contains(), find(), and findNoCase() to determine which is the best option for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消