Re: URL-String-concatenation within Curl-Multi: a Loop-array: [can i do like so]

9 views
Skip to first unread message

Martin Kaspar

unread,
Nov 30, 2010, 1:04:00 PM11/30/10
to PHP Hacks, martin...@campus-24.com
Hi - good evening!



Thx for the answer and all the help so far Oncemore the "Fetching-
part" for a little parser-script:

Here we go - new target urls:

see the overview: http://dms-schule.bildung.hessen.de/index.html
http://dms-schule.bildung.hessen.de/suchen/suche_schul_db.html
Search by pressing the button "type" and then choose all schools with
the mouse!
Results 2400 schools: Here i can provide some "more help for getting
the target!" -


btw: see some details for this target-server:
http://dms-schule.bildung.hessen.de/suchen/suche_schul_db.html?show_school=9009
http://dms-schule.bildung.hessen.de/suchen/suche_schul_db.html?show_school=9742
http://dms-schule.bildung.hessen.de/suchen/suche_schul_db.html?show_school=9871


well - you see i have to iterate over the sites - with a function /(a
loop)
http://dms-schule.bildung.hessen.de/suchen/suche_schul_db.html?show_school=1000
to 10000

BTW - after fetching the page i have to see which one are empty -
those ones do not need to be
parsed! Well - i want to do this with curl-multi since this is the
most advanced way to do this:

I see i have an array that can be filled I have to try it out...!!

Well, I'm not pretty sure - but judging by the low level of PHP i
have:
I think that i may need a double array to define the URLs like:


Can i do like so?:
[php]
$urls = array(
"siteone" => "suche_schul_db.html?show_school=%i",
"sitetwo" => "suche_schul_db.html?show_school=%i",
"sitethree" =>"suche_schul_db.html?show_school=%i"
);


$params = array ( for ($i = 1; $i <= 10000; $i++) {
// body of loop
}

// well i have to define the variables in a open form like abvove
nand not below:
// better than doing it like so: "siteone" => array(9009, 9742,
9871),

);

then pass them to curl-multi as:

foreach ($urls as $id => $url) {
foreach ($params[$id] as => $param) {
$i = $id . $param;
$finalurl = sprintf($url, $param);
$conn[$i] = curl_init($finalurl);


[/php]

I don't know if that's fits the needs tip that i am looking for but I
hope so ;-)

Can i do like so [see above]? What do yu think.


i send you many greetings

martin
Reply all
Reply to author
Forward
0 new messages