how to prevent PHP's file_get_contents( )

后端 未结 4 1665
攒了一身酷
攒了一身酷 2021-01-14 17:23

one of my php page returns data like this:


but someone else use file_get_contents() to get m

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-14 17:52

    Your fighting an uphill battle here. I am assuming your serverside process that responds in json is being consumed via javascript in your users browsers... so there is no easy way to encrypt it. You might try some of the techniques used to prevent xspf (see http://en.wikipedia.org/wiki/Cross-site_request_forgery ). If you developed the client to pass along some session token that is uniq per client you could reduce some of the problem. But, chances are whoever is stealing your data is gonna figure out whatever mechanism you put in place ... assuming this is some sort of ajax type thing. If its a server-server thing then as sli mentions, setting up some restrictions based on the remote ip would help, plus setting up some sort of API authentication tokens would help even more (see oauth for some pointers)

提交回复
热议问题