![]() |
Pulling values from one site as reference
Hey,
I'm trying to figure out if its possible to pull a value(s) from one site (site a) and update my site (site b) with whatever those values are? What function is available in PHP for this, if any? |
How about using regular expressions? For instance, you could use this little bit of code to get the latest 5 articles from TalkPHP, as displayed on the left of the website:
php Code:
|
hey thanks, I'm stil learning regular expressions. Could you tell me what (.+?) does please?
Edit: Also, I'm pulling an image from a site but it's only adding the <img src="/path/to/image.jpg"> and so the image doesn't display. I need to manually add the URL infront of it. I'm not sure how to do this within the regular expression. |
The .+? says any character but white space, and find all those characters, but in non-greedy form, so when it finds the less than symbol "<" it will stop capturing.
For the appending of the URL to the image path, you could try something like the following: php Code:
|
Quote:
. will match any character which isn't the newline character (so the same as [^\n]): any other whitespace character (like space, tab, carriage return) will be matched. With the s (PCRE_DOTALL) modifier, the dot will match any character (including the newline). |
| All times are GMT. The time now is 05:46 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0