Answer the question
In order to leave comments, you need to log in
Trouble finding information on CURL page, PHP Devel Studio, help?
And so I will try to describe the problem in as much detail as possible, I wrote a project on PHP Devel Studio so that I would always know the online one server. On the server forum there is a monitoring of the desired game, something like a grabber made in PHP Devel Studio, when you click on the button, it should go to the forum page to find the necessary information there in a certain block.
Here is the code that I put in the button:
global $cookie;
$ch=curl_init();
curl_setopt ($ch, CURLOPT_POST,0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_VERIFYHOST,0);
curl_setopt ($ch, CURLOPT_FAILONERROR,1);
curl_setopt ($ch, CURLOPT_HEADERM, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt ($ch, CURLOPT_URL,'http://forum.pvp.uz');
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
$out=curl_exec($ch);
curl_close($ch);
preg_match_all('#<div style="margin-top: -18px;"><nobr><b>12 / 25</b></nobr></div>#',$out ,$matches);
$online=$matches[1][0];
c("memo1")->text = $online;
<div style="margin-top: -18px;">
<nobr>
<b>18 / 25</b>
</nobr>
</div>
Answer the question
In order to leave comments, you need to log in
$sourceContent = '<div style="margin-top: -18px;">
<nobr>
<b>18 / 25</b>
</nobr>
</div>';
$regExpWrapper = "#(?:<nobr>(?:.*)(?:<b>))(.*?)/(.*?)(?:</b>)#s";
preg_match($regExpWrapper, $sourceContent, $matches);
echo iconv("UTF-8", "CP866", $matches[1]." из ".$matches[2]);
$regExpWrapper = "#(?:\"wa-progress\")(?:.*?)(?:</div>(?:.*?)>(.*?)/(.*?)</div>)#s";
$cURL = curl_init();
curl_setopt ($cURL, CURLOPT_URL,'www.goldcs.ru');
curl_setopt ($cURL, CURLOPT_RETURNTRANSFER,1);
curl_setopt ($cURL, CURLOPT_SSL_VERIFYPEER, 0);
$cURLResult = curl_exec($cURL);
curl_close($cURL);
preg_match($regExpWrapper, $cURLResult, $matches);
echo iconv("UTF-8", "CP866", $matches[1]." из ".$matches[2]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question