Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 5 of 5

Thread: Very Difficult Ajax and Php extraction

  1. #1

    Very Difficult Ajax and Php extraction

    Hi!

    I have a problem:

    in these pages when you make a click on a row, it displays a div with info i need to get, i need a php script to allow me to go all across the table and get the info in the divs. i think it may be very hard!

    http://bccathletics.cstv.com/sports/...ched-2006.html

    http://aamusports.cstv.com/sports/m-...ched-2006.html

  2. #2
    not really

    just analyze the source for client-side (I guess it's a <hr onClick><hr>)

    give the row an ID and fetch the corresponding row in your database, load it into a div and voila

    what's bugging you ?

  3. #3
    icio's Avatar
    3,811
    posts
    looks better in lowercase
    This will return all of the XML files containing the information used to populate each div:

    Edit: MLK, I think here was asking for a script to get the information from the page, not recreate the effect. Which is it, dinchu37?

    PHP Code:
    <?

        $url 
    'http://bccathletics.cstv.com/sports/m-basebl/archive/beth-m-basebl-sched-2006.html';
        
        
    // This script might take a while to run...
        
    set_time_limit(0);
        
        
    // Setup and execute the curl session
        
    $curl curl_init($url);
        
    curl_setopt($curlCURLOPT_RETURNTRANSFERTRUE);
        
    $source curl_exec($curl);
        
    curl_close($curl);
        
        if (
    $source === false) {
            
    // Weren't able to retrieve the page
            
    die("An error occured");
        }
        
        
    header('content-type: text/plain');
        
        
    // Now we need to get the information from the table rows
        
    preg_match_all('/<tr id="(\\d+)" title="(.*?)"/'$source$matchesPREG_SET_ORDER);
        foreach (
    $matches as $match) {
            
    print_r($match);
            
            
    $xml_file "http://bccathletics.cstv.com/data/xml/events/m-basebl/2006/{$match[1]}.xml";
            
            
    $curl curl_init($xml_file);
            
    curl_setopt($curlCURLOPT_RETURNTRANSFERTRUE);
            
    $source curl_exec($curl);
            
    curl_close($curl);
            
            echo 
    $source;
            echo 
    "\n-----------------------------------------------------\n";
        }
    "60% of the time it works... every time." -- Paul Rudd as Brian Fantana.

  4. #4
    icio: you solved me more troubles than what i was asking for!

    I just wanted a code to make appear all the data included in the div, but now the entire problem is solved. thank you very much!

  5. #5
    icio's Avatar
    3,811
    posts
    looks better in lowercase
    Awesome. Glad I could help
    "60% of the time it works... every time." -- Paul Rudd as Brian Fantana.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012