Jump to content

[SOLVED] Yahoo Pipes meets Facebook


BandonRandon

Recommended Posts

Hello,

 

So I've been trying to create a Lifestream http://blog.bandonrandon.com/lifestream for myself. I have found the feed url to my facebook mini feed but i feel that facebook gives away to much information for a public feed. A friend told me to use yahoo pipes http://pipes.yahoo.com/pipes/ which will let me modify the feeds content. Well it works great but I have a unique regex problem for someone. 

 

The feed will output data like this:

# FirstName LastName accepted your friend request.

# FirstName LastName  wrote on your Wall.

# FirstName LastName wrote on your Wall.

and so on and so fourth.

 

I would like this to read

# Someone accepted My Name's friend request.

# Someone wrote on My Name's Wall.

# Someone wrote on My Name's Wall.

 

one of the pipes operators is regex where i can replace variables. I am still very new to regex and am getting better but still need to be coached on it.

 

Thanks,

Brandon

 

Link to comment
https://forums.phpfreaks.com/topic/125439-solved-yahoo-pipes-meets-facebook/
Share on other sites

Assuming they use PCRE:

 

<pre>
<?php
$data = <<<DATA
# FirstName LastName accepted your friend request.

# FirstName LastName  wrote on your Wall.

# FirstName LastName wrote on your Wall.
DATA;

echo preg_replace('/^(.+?)(?=accepted|wrote)/m', 'Someone ', $data);
?>
</pre>

 

You can use str_replace to exchange "your" with your name, since it should be static ;)

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.