Jump to content

[SOLVED] Have a confusing string problem


ces

Recommended Posts

Hello, i got a problem with getting my code readed. And am not sure that my Subject tells exactly what i want to say. Anyway let me explain it with showing ...

 

Im trying to get an info from another site with php coding and everything works except this. My code is something like that;

 

$foundMatch = $this->getMatch('|font-weight:bold;padding:5px"><a href='(.*)'>|Uis', $data);

 

Here, as you can see, im getting info from the target web sites source codes (from the data starting with font-weight:bo...) and getting the link of what i want after reading that a href...

 

But ... target site pointed the a href to start with ' value not ". So when i enter that it thoughts like im ending my getMatch('... command. If i start getMatch with " instead of ' then it ends it after 5px" part. So i cant read the target link behind ' ' tags after the a href= .

 

Im sure that i can add that a href='(.*)' without ending my getMath command but i dont know how.

 

I'll be glad if someone helps.

 

Thanks alot, and ohw im new here so hello :)

 

Ohw and i forgot .. if i write like that, it gives; " Parse error: syntax error, unexpected '(' ... ".

Link to comment
https://forums.phpfreaks.com/topic/152200-solved-have-a-confusing-string-problem/
Share on other sites

Welcome to PHP Freaks!

 

From what I can see you're using single quotes without escaping the ones in the middle.

 

$foundMatch = $this->getMatch('|font-weight:bold;padding:5px"><a href="(.*)">|Uis', $data);

 

Try that - without knowing what's inside getMatch() it's tricky to diagnose accurately.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.