TheSky Posted May 19, 2011 Share Posted May 19, 2011 Hey agen i have problem i need info from other webpage <?php // get as ? $url=$_GET['url']; // value of script $website = $url; $referer = 'olar.eu'; $useragent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'; $filename = basename($url); // connect $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_USERAGENT,$useragent); curl_setopt($curl_handle,CURLOPT_AUTOREFERER,$referer); curl_setopt($curl_handle,CURLOPT_URL,$website); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $source = curl_exec ($curl_handle); curl_close ($curl_handle); $a=preg_match("/>Level:.*.\n.*.>([0-9]*)</",$source,$b); $Level = $b[1]; echo "Level: $Level"; ?> i get only empty value url=http://www.gamersfirst.com/warrock/?q=Player&nickname=admin-b13r Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/ Share on other sites More sharing options...
fugix Posted May 19, 2011 Share Posted May 19, 2011 i would try changing your url to the correct url syntax eg. $referer = 'http://www.olar.eu'; Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/#findComment-1217581 Share on other sites More sharing options...
TheSky Posted May 19, 2011 Author Share Posted May 19, 2011 it's not realy important what i got on referer connect part is ok i think ? becouse i dont get any errors but i think there is some mistake on data filtering Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/#findComment-1217585 Share on other sites More sharing options...
fugix Posted May 19, 2011 Share Posted May 19, 2011 its very important that you get the url correct, otherwise curl is useless Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/#findComment-1217593 Share on other sites More sharing options...
TheSky Posted May 19, 2011 Author Share Posted May 19, 2011 hmm now i think url http://www.gamersfirst.com/warrock/?q=Player&nickname= is not possible to get becouse it has ?= Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/#findComment-1217606 Share on other sites More sharing options...
fugix Posted May 19, 2011 Share Posted May 19, 2011 hmm now i think url http://www.gamersfirst.com/warrock/?q=Player&nickname= is not possible to get becouse it has ?= if its a dynamic url then yeah Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/#findComment-1217614 Share on other sites More sharing options...
TheSky Posted May 19, 2011 Author Share Posted May 19, 2011 i just tryed with http%3A%2F%2Fwww.gamersfirst.com%2Fwarrock%2F%3Fq%3DPlayer%26nickname%3Destonia8 and it is working now i have question how i can convert http://www.gamersfirst.com/warrock/?q=Player&nickname=estonia8 to http%3A%2F%2Fwww.gamersfirst.com%2Fwarrock%2F%3Fq%3DPlayer%26nickname%3Destonia8 Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/#findComment-1217620 Share on other sites More sharing options...
QuickOldCar Posted May 19, 2011 Share Posted May 19, 2011 http://php.net/manual/en/function.urlencode.php Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/#findComment-1217627 Share on other sites More sharing options...
TheSky Posted May 19, 2011 Author Share Posted May 19, 2011 ok i need one thing more know how i make full url with url$nickname $url=('http://www.gamersfirst.com/warrock/?q=Player&nickname='$nickname); Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/#findComment-1217695 Share on other sites More sharing options...
QuickOldCar Posted May 19, 2011 Share Posted May 19, 2011 This is just one way. $url= "http://www.gamersfirst.com/warrock/?q=Player&nickname=$nickname"; Just wrap in double quotes, and if do any quotes within the doubles would need to be single quotes. Quote Link to comment https://forums.phpfreaks.com/topic/236866-get-data-from-other-webpage/#findComment-1217790 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.