Forum

> > Off Topic > Get content from url
Forums overviewOff Topic overviewLog in to reply

English Get content from url

3 replies
To the start Previous 1 Next To the start

old Get content from url

SnipeR95
User Off Offline

Quote
Hi everyone. I need get content from url but i can't.

in "unrealsoftware.de/dev.php" a link to check user if logged usgn. if logged, return 1 else return 0.

I am making a 'website' and i need control User was logged to usgn. How i get the '1' or '0' value from this link?

Thanks.

old Re: Get content from url

ohaz
User Off Offline

Quote
PHP:
1
2
3
4
5
6
$nick = "ohaz";
$randomKey = CREATE_RANDOM_KEY($nick);
$valid = file_get_contents("http://www.unrealsoftware.de/connect.php?keyof=".urlencode($nick)."&iskey=".urlencode($random_key));
if ($valid){
...
}
The url the user would've to click on would be:
1
<a href="http://www.unrealsoftware.de/connect.php?setkey=<? echo $randomKey; ?>" target="_new">http://www.unrealsoftware.de/connect.php?setkey=<? echo $randomKey; ?></a>

You'd need to write your own CREATE_RANDOM_KEY($string) function of course

old Re: Get content from url

SD
User Off Offline

Quote
Don't use file_get_contents, it's slow. Use cURL instead.
1
2
3
4
5
6
7
8
9
$url = 'http://www.unrealsoftware.de/connect.php?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview