Jump to content

Search the Community

Showing results for tags 'manipulate links'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello. This is my first post, and i hope i post this topic in the right area. So, i have a script which gets content from another site using $dom and i want to manipulate the exported links. I have in the script the line " $td->getElementsByTagName('a')->item(0)->setAttribute('href', 'http://google.com'); " which edit the links from col 2, and i want to make the same with the links from col 10. And in col 10 i have some problems showing the results just like on the website. Please help. Thank you ! <?php $content = file_get_contents("http://www.soccerway.com/national/germany/bundesliga/20122013/regular-season/"); $content = '<?xml encoding="UTF-8">' . $content; libxml_use_internal_errors(true); $dom = new DomDocument(); $dom->loadHTML($content); libxml_clear_errors(); $xpath = new DomXPath($dom); $tabele = $xpath->query('//table[contains(concat(" ", normalize-space(@class), " "), "leaguetable")]'); $tabel = $tabele->item(0); $trs = $tabele->item(0)->getElementsByTagName('tr'); print '<table>'; foreach($trs as $rowIndex => $tr){ $tds = $tr->getElementsByTagName('td'); if($rowIndex > 18) continue; print '<tr>'; foreach($tds as $colIndex => $td){ if($colIndex == 2) $td->getElementsByTagName('a')->item(0)->setAttribute('href', 'http://google.com'); if($colIndex > 11) continue; // salveaza HTML printf('<td> %s </td>', $dom->saveXML($td)); } print '</tr>'; } print '</table>'; ?>
×
×
  • 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.