Forum

> > Off Topic > Get content from url
ForenübersichtOff Topic-ÜbersichtEinloggen, um zu antworten

Englisch Get content from url

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Get content from url

SnipeR95
User Off Offline

Zitieren
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.

alt Re: Get content from url

ohaz
User Off Offline

Zitieren
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

alt Re: Get content from url

SD
User Off Offline

Zitieren
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);
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenOff Topic-ÜbersichtForenübersicht