How to use client ip in file_get_contents

Asked

Viewed 199 times

1

I made a script that extracts the link from any video that is hosted in mp4upload, only when the link is extracted the ip of my site that is identified. What I wanted to know how to make the client’s ip be identified ? I have tried to use Curl but it does not work :/

<?php
$url = 'http://www.mp4upload.com/embed-'.$_GET['id'].'.html'; //:D 
$v=@file_get_contents($url);
$source = explode("'file':", $v);
$source = explode(',', $source[1]);
$source = explode("'", $source[0]);
foreach($source as $link){$source = $link;if($source!=''){echo $video = $source;}} 

?>
  • if you really need it, maybe a proxy can solve it, but the proxy would have to be your client’s ip.

1 answer

0


In a short answer Is not possible do this via PHP, as well as:

  • Your browser is client from your PHP server.
  • PHP will be client mp4upload.

In other words, it is your server that is taking the data and then passing it to your browser.

The only way to do this would be to make this process in front-end, using Javascript for example, but there is still another problem with this, for security browsers block requests from one server on another (read on CORS).

In other words, you can’t force mp4upload add headers to enable the CORS, unless they had their own API for developers like we use (I didn’t find any API) or also it is not possibleI do this via javascript (front-end)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.