Jump to content

Recommended Posts

Hey, im using curl to get a page and I would like to use preg_match_all to find links that start with something.

 

for example the links look something like this:

 

http://quiver.outwar.com/joinraid.php?raidid=379141&h=abc0bbf0b2e4acfec4b6dc7a3a05557b

 

but the raidid changes every time so i need to grab all the links that start with

http://quiver.outwar.com/joinraid.php?raidid= so I can get the raid id from each.

 

can anyone help me with the regex?

Link to comment
https://forums.phpfreaks.com/topic/163168-preg_match_all/
Share on other sites

so in my example, I used $content to represent the page you are cURLing.  Are you using the right variable there? If so, did you echo it out to make sure you're actually getting the content? If so, post an example of the  link (and some of the content surrounding it) from what you what you retrieved from your cURL.

Link to comment
https://forums.phpfreaks.com/topic/163168-preg_match_all/#findComment-860898
Share on other sites

http://pulse.comxa.com/raid/get_raid.php Chancellor Fangore is the link i want to get, this is the code:

 

$data = $result1;
echo $data;
preg_match_all('~<a[^>]*href\s?=\s?["\']http://quiver.outwar.com/joinraid.php\?raidid=([^"\']*)"~i',$data,$matches);
print_r($matches);

Link to comment
https://forums.phpfreaks.com/topic/163168-preg_match_all/#findComment-860900
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.