FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to do the String concatenation with PHP - running a little Parser based on cURL
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How to do the String concatenation with PHP - running a little Parser based on cURL [message #170790 is a reply to message #170777] Fri, 26 November 2010 12:29 Go to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
El 25/11/2010 19:09, matze escribió/wrote:
> i am currently workin on a little parser with cURL - and i have some
> questions here: How to do the String concatenation with PHP ; note i
> wanna do it with curl!

I'm sorry but I find it very difficult to understand your question and
I'm sure I'm not the only one. You've mentioned three fairly unrelated
pieces of info and it's not clear how they relate each other:

1. String concatenation
2. Curl
3. Writing a parser

My educated guess is that you are scrapping a third-party site and you
want to write a custom HTML parser to extract information but I'm not
sure that makes sense. Parsing HTML is *very* hard. Even PHP gurus use
some of the built-in parsers rather than writing their own.

Let's analyse the information provided:

> the target URL: http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=572.8745475728288
> click all checkbuttons
> Results: approx 6400 results
> Here i can provide some "more help for getting the target!" - btw see
> three detail page:
>
> http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=261.2855969084779 &SchulAdresseMapDO=116191
> http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=261.2855969084779 &SchulAdresseMapDO=116270
> http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=261.2855969084779 &SchulAdresseMapDO=188268
>
> btw: we can loop over the results - with a iteration -

What's this? Is it site you are building? Is it the third-party site
you're scrapping? Is it something entirely different?


> especially i wanna know: how to do the String concatenation with PHP ;
> note i wanna do it with curl!

Curl is an HTTP library; I don't think it provides string manipulation
functions. What you do you want to do exactly?

> how to do the String concatenation with PHP ; note i wanna do it with
> curl!

If PHP, as Michael Fesser pointed out, you use the string concatenation
operator:

http://es.php.net/manual/en/language.operators.string.php


> function get_page_data($url) {
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, $url);
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> $output = curl_exec($ch);
> if($output!=false&& $_POST['dt']=='No')
> return $output;
> curl_close($ch);
> }

This uncommented function appears to download a remote file and return
it as string. Is it failing or something?


> for($i=1;$i<=$match[1];$i++)

You are looping something. We don't know what.

> {
> $url = "http://www.example.com/page?page={$i}";
> $data = get_page_data($url);
> if($data) {
> $cleaned = string_between('onload="check();">','</body>', $data);
> return = stip_tags($cleaned, '<table><tr><td><div>');

This exists the loop as soon as a download succeeds. Is that what you
intended?

> }
> }
>
> any and all help will be greatly appreciated

Again, what are you doing and what's the question?



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: All preciseinfo.org collections are updated
Next Topic: Get IP Address Help
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 05:13:01 GMT 2024

Total time taken to generate the page: 0.04465 seconds