Php HTTP_REFERER imitation code (1/2)

Source: Internet
Author: User

<? Php tutorial
If (! Isset ($ _ server ["http_referer"])
Echo "no referer ";
Else
Echo $ _ server ["http_referer"];
?>

If you click the link above, the referer page is displayed.
Copy the Code as follows:

Set http = createobject ("msxml2.xmlhttp ")
Http. open "get", "http://www.bkjia.com/test/referer.php", false
Http. setrequestheader "referer", "http://www.bkjia.com"
Http. send
Wscript. echo http. responsetext


However, if I use vbs to call the msxml2.xmlhttp component to access this page, no referer is returned. It's incredible. Isn't my code wrong?


So google googled "vbs forged http referer" and found that most of the content found is the same as this article. You copy and paste it without reading it. If you copy my content, I copy your content, I don't know who it is, and it's still wrong!
The first example of that article is the asp tutorial


Copy the Code as follows:

Dim http
Set http = server. createobject ("msxml2.xmlhttp ")
Http. open "get", url, false
Http. setrequestheader "referer", "http://www.fromdomain.cn /"
Http. send ()

At first, I thought that the vbs under asp is different from the vbs that I directly double-click to run. The vbs under asp is awesome and can be changed to the referer. For this reason, I also installed iis for testing and found that no referer is returned. Later, I saw the following message: "forgive me for not being familiar with asp. I can't help you. Please check other materials and refer to it." "I have no idea how to use asp, the code is for reference only. asp has not been tested ".

I really don't want to swear. If you're not familiar with it, you just need to write it. At least let's test it. The code that has not been tested can also be pasted? Later, I saw a reliable answer on Qianyi Network (this network looks good). referer cannot be changed by setting headers in asp and ajax.

Angry, now that the xmlhttp component is not working, I will use socket to write the general line! (Note: not all computers have registered the winsock component)


1 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.