Opening Multiple Files/Links in Order.


Posted on 16th Feb 2014 07:03 pm by admin

I want to open links in order/one-by-one and check each for a specific string.

Example:
If i open CL, search for ads pertaining to video games. Returns 20 results. I grab these links. Now i want to open each of these links one-by-one to see if an email address is included.

As of now i am able to retrieve the links, but need to know how to parse them one-by-one to check the email address.
I will then either copy the address or immediately return back to the list of links if the address is non-existent.

So here's my current code for this process thus far.
Code: [Select] <?php
function curlURL($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2');
$output = curl_exec($curl);
return $output;
}

$curlResults = curlURL("http://southcoast.craigslist.org/sss/");
$pattern = '#<a href="(/[a-z]{3}/d{10}.html)">#';
preg_match_all( $pattern, $curlResults, $matches);

echo "<pre>n";
echo "Links:nn";
foreach ($matches[1] as $link):
echo "t" . '<a href="' . $link . '" target="_BLANK">' . $link . '</a>' . "n";
endforeach;
echo '</pre>';


?>

No comments posted yet

Your Answer:

Login to answer
78 Like 13 Dislike
Previous forums Next forums
Other forums

Price in PR
Dear Experts,
Why we have to enter the price in the PR, and why there is no free goods indicato

Undefined variable when using $_SERVER['PHP_SELF']
Hi guyz, please suggest me something...
On first.php I have one input field NAME, and on posting

Get content from table into a list, without repeating.
Alright this is kinda an odd thing, so I need some help.

I have a table "quote" wit

Require select-option functionality in Module Pool Programming
Hi Gurus,

I am doing a development by Module Pool on Warehouse Management. For that devel

Simultaneous select/update/insert
Hi

How would I need to go about when 2 users update a single row simultaneous? And how would

Hi, explode and strstr.
Hi, I seem to be confused about the strstr function, eg. i have a string like:
"a.b.c.d.e.f&

How to return to a previous page after running a PHP script
I'm having a bit of a melt down here because I think this should be really easy but can't work it ou

Why is this function returning a false value when it shouldn't be??
This is in an include file. I want it to check a value in an html form and see if it's just white s

Onclick problem in Firefox
Hi,
I am using a . It doesn't seem to

ALV List display - header width adjust
Hi,

I am using REUSE_ALV_LIST_DISPLAY for my ALV display.The width of the ALV varies for

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash