/    Sign up×
Community /Pin to ProfileBookmark

header() headaches

Here’s the eg:

page.php?go=1 redirects through header() to test*com

Here’s the problem: how to get this url test*com with a php script ?

I tried with file_get_contents() but it only gets the content of the test*com and I can’t retrieve the url.
Other way is getting content between <title></title> and exploding but this is so unreliable.

Any suggestions how to solve this problem ?

Thank you!

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@nshiellJun 04.2007 — <?php

if ($_GET['go'] == 1)

{

header( 'Location: http://www.yoursite.com/new_page.html' );

die('');

}

?>
Copy linkTweet thisAlerts:
@redhatlookJun 04.2007 — ? what do you need?
Copy linkTweet thisAlerts:
@burialauthorJun 05.2007 — Here's the solution:

[CODE]<?php
if (($io = fsockopen( "(URL address blocked: See forum rules)", 80, $errno, $errstr, 5)) !== false)
$send = "GET /go.php?id=123 HTTP/1.1rn";
$send .= "Host: (URL address blocked: See forum rules)rn";
$send .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204rn";
$send .= "Referer: (URL address blocked: See forum rules)rn";
$send .= "Accept: */*rn";
$send .= "Connection: Closernrn";
fputs ($io, $send);
$send = '';
do { $send .= fgets ( $io, 4096 ); }
while ( strpos ( $send, "rnrn" ) === false );
echo "$send<BR>";
?>[/CODE]
×

Success!

Help @burial spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...