ces Posted April 2, 2009 Share Posted April 2, 2009 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 More sharing options...
Yesideez Posted April 2, 2009 Share Posted April 2, 2009 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. Link to comment https://forums.phpfreaks.com/topic/152200-solved-have-a-confusing-string-problem/#findComment-799260 Share on other sites More sharing options...
ces Posted April 2, 2009 Author Share Posted April 2, 2009 Thanks alot for the reply but it found nothing with " " tags as its ...font-weight:bold;padding:5px"><a href='...'> on the sites source codes. i think i must use '..' tagging after href= to read the data between. Link to comment https://forums.phpfreaks.com/topic/152200-solved-have-a-confusing-string-problem/#findComment-799266 Share on other sites More sharing options...
Yesideez Posted April 2, 2009 Share Posted April 2, 2009 In that case we'll escape them: $foundMatch = $this->getMatch('|font-weight:bold;padding:5px"><a href=\'(.*)\'>|Uis', $data); Link to comment https://forums.phpfreaks.com/topic/152200-solved-have-a-confusing-string-problem/#findComment-799269 Share on other sites More sharing options...
ces Posted April 2, 2009 Author Share Posted April 2, 2009 Thanks alot that was what am looking for, works perfect... Link to comment https://forums.phpfreaks.com/topic/152200-solved-have-a-confusing-string-problem/#findComment-799275 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.