file_get_contents with preg_match

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
EtniesDC
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Jan 12, 2019 12:49 pm

Sat Jan 12, 2019 1:05 pm

Hello, I work on stats web for game SWAT 4 and I need little hlep with file_get_contents and preg_match or any other.
Im trying many ways, but noone was good.
I need take for ex. primary weapon ID from player site https://www.markmods.com/player/Agent00763717/.
I think the biggest problem is with ssl certificate on source.

<?php
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$response = file_get_contents("https://www.markmods.com/player/Agent00763717/", false, stream_context_create($arrContextOptions));
preg_match("Primary.weapon:\K.....", $response, $match);
echo $match;
?>

Something like this Im trying, but It no work. Dont waste time with regex, its example only, I need only working echo regex from source.
Thank you for answer.

EtniesDC
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Jan 12, 2019 12:49 pm

Sun Jan 13, 2019 9:30 pm

Nobody? :help:

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 792
Joined: Mon Feb 22, 2016 5:52 pm

Mon Jan 14, 2019 12:21 pm

Nobody? :help:
This isn't the most active site, so you may have to wait a bit longer for a reply, although you may not get one at all as your post doesn't make a lot of sense:
with preg_match
Dont waste time with regex
????

For starters, you could do with spending a bit of time reading your own post to see if it makes sense, explaining a bit more about your problem and what you have done to resolve it:

Are you asking a question? or just throwing it out there in the hope you will get what you want?
Have you written this code? or copy and pasted a script from somewhere else?
What errors are you getting? have you got display errors turned on?
or
Are you expecting someone to write a script for you?

EtniesDC
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Jan 12, 2019 12:49 pm

Mon Jan 14, 2019 9:51 pm

Thank you for answer. I write this script, but it returns any ssl security error. It is working script for another sites as source. With preg_mach or regex Is not problem for me. I need only add any security lines.

Post Reply