Jump to content

[SOLVED] Easy preg_match_all question ... I must need sleep.


Recommended Posts

I've done this a hundred times so not sure why it's not working now....

Here's an example of the line in another website I'm targeting:

<span class="bull1">• </span><a class="menu-sub-level" title="Dark Chocolate" href="http://www.furniturexo.com/advanced_search_result.php?keywords=&categories_id=&inc_subcat=1&manufacturers_id=32&group_id=&type_id=&style_id=&collection=Dark+Chocolate&pfrom=&dfrom=&dto=&x=0&y=0">Dark Chocolate</a>

 

I only Need to extract the actual URL and Text between the anchor... In this case Dark Chocolate 

 

Here's the code I'm using.

 

$data = @file_get_contents("http://www.0000000.com/XXXXXXX.html");  ;

preg_match_all('/y=0".*?><"([^"]*)".*?a>"([^"]*)"/is',$data,$out);

$d = array_combine($out[1], $out[2]);

foreach($d as $k=>$v){

echo $v . "<br>";

}

 

 

Thanks in advance for the help.  I must need sleep... It's been a long 2 day session.

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.