last day (24 days later) » 

10:10 AM
0
A: cURL : Proxy Server getting target image

georootI think what you mean to say is if the final link has an img then it is not changing the url inside "src" attribute. That is not possible in curl. What you need to do for that is parse the html and the manually change the links so that they are directed from your proxy server. Also for creating ...

 
i have this target site test1.com with ip 1.1.1.1 , i can access the content using my proxy script domain test2.com but it did not get the images, sample. test1.com/img/1.jpg it gives the image , but in test2.com/img/1.jpg it give an Not Found .
 
Okay let me add a sample script for you in my answer. :)
 
ah .. okay, can i have it? :) thank you sir. i'll check and test your script, its a big help :)
 
@rkevx21 Check out the code. Also in case of file_get_contents , you can use curl. But i prefer this function because it is lesser typing for me :)
 
can you send it in my email sir?
 
10:10 AM
Just copy from above :) i will be sending the same code.
 
ok sir. i'll try your code :)
as i add to var_dump($url); it gives me this result -> float(1.1) NULL
 
My bad bug in code. check now. Instead of concatinating the string i was adding them
 
what does it mean if var_dump($http_response_header); result is NULL ?
as i vardump $_SERVER['REQUEST_URI'] , the result is string(1) "/"
 
here is a link to article php.net/manual/en/reserved.variables.httpresponseheader.php . Which explains the output and has sample code
basically you are using the request_uri to get the file type
it distinguishes between images and html content which you need to send to browser
so once you get output similar to the link i sent above.
explode the string and see which all parameters you want to send to client of yours.
an important parameter is content-type which determines the type of file content
 
hi sir
this is my whole code
--1st---
$host = "85.214.239.6"; //This is the host
var_dump($_SERVER['REQUEST_URI']);
$url = $host.$_SERVER['REQUEST_URI'];
var_dump($url);
echo file_get_contents($url);
var_dump($http_response_header); //For debugging
-- 2nd --
function get_contents() {
file_get_contents("http://www.mistergrip.de");
var_dump($http_response_header);
}
get_contents();
var_dump($http_response_header);
*** the 1st part it gives me the NULL in http_response but in the 2 part it gives me the header
 
10:29 AM
i have this code

function get_contents() {
file_get_contents("http://www.mistergrip.de");
echo "<pre>";
var_dump($http_response_header);
echo "</pre>";
echo "<pre>";
print_r(parseHeaders($http_response_header));
echo "</pre>";
}
get_contents();
echo "<pre>";
var_dump($http_response_header);
echo "</pre>";


function parseHeaders( $headers )
{
$head = array();
foreach( $headers as $k=>$v )
{
$t = explode( ':', $v, 2 );
if( isset( $t[1] ) )
$head[ trim($t[0]) ] = trim( $t[1] );
else
{
$head[] = $v;
------------ and the results is

array(12) {
[0]=>
string(15) "HTTP/1.1 200 OK"
[1]=>
string(13) "Server: nginx"
[2]=>
string(35) "Date: Mon, 11 Apr 2016 10:27:25 GMT"
[3]=>
string(38) "Content-Type: text/html; charset=UTF-8"
[4]=>
string(17) "Connection: close"
[5]=>
string(38) "Expires: Thu, 19 Nov 1981 08:52:00 GMT"
[6]=>
string(77) "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
[7]=>
string(16) "Pragma: no-cache"
[8]=>
string(27) "X-Frame-Options: SAMEORIGIN"
---- whats the next step should i do?
 
11:03 AM
--- help me sir. thank you
 

  last day (24 days later) »