-2

What I'm actually trying to do is getting content of an URL from another site there I want get the content by client ip address NOT server. Is there any way to do this?

Here I tried some how but, not succeed :/

<?php
$homepage = $_SERVER['REMOTE_ADDR']file_get_contents('http://www.example.com/');
echo $homepage;
?>

I'll accept if there is a way in javascript also.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Amir
  • 5
  • 3
  • 2
    What do you mean by _"get the content by client ip address NOT server"_? If you have a question, please spend time in articulating your question with a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) – Thangadurai Mar 15 '18 at 12:00
  • MR @Thangadurai when i'm getting content of for example google it's getting by server ip address which is something that don't want. – Amir Mar 15 '18 at 12:02
  • Am I the only one around here that doesn't quite understand what OP is trying to achieve? What content do you want to get from a regular user's computer? – brombeer Mar 15 '18 at 12:16
  • @kerbholz . I'm trying to get the **http://example.com/testm3u8?wmsAuthSign=code** using PHP get content as u can see that code at the end of url is changing by ip address and it's not working by server ip address. only claint ip :D – Amir Mar 15 '18 at 12:22
  • Assuming the client is a browser, since you can't run PHP in the browser, you can't do this with PHP. – Quentin Dec 15 '18 at 08:07

1 Answers1

-1

Use the following:

<?php
    $user_agent = $_SERVER['HTTP_USER_AGENT']; 
    $ip_address = $_SERVER["REMOTE_ADDR"];     
    $page_name = $_SERVER["SCRIPT_NAME"];      
    $query_string = $_SERVER["QUERY_STRING"];   
    $current_page = $page_name."?".$query_string; 
    echo $ip_address
?>
huw
  • 45
  • 1
  • 6