Re: RES: CURL problems still

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nathan Rixham wrote:
Miller, Terion wrote:

Well I tried it and still it stopped at the "C's"

1:
your script is timing out, you need to set the time limit higher
set_time_limit(0);

2:
foreach($html->find('table') as $table) {
$rows = explode('</tr>' , $table );
$headerCells = explode('</th>', array_shift($rows));
$struct = array();
foreach( $headerCells as $c => $cell ) {
  $struct[] = str_replace(' ', '_', trim(strtolower(strip_tags( $cell ))));
}
$data = array();
foreach( $rows as $r => $row ) {
  $cells = explode( '</td>' , $row );
  $item = array();
  foreach( $cells as $c => $cell ) {
    $item[$struct[$c]] = trim(strip_tags( $cell ));
  }
  $data[] = $item;
  $query = "INSERT into `warrants` ";
  $query .= "(name, age, warrant, bond, wnumber, crime)";
  $query .= " VALUES (";
  $query .= " '{$item['name']}',";
  $query .= " '{$item['age']}',";
  $query .= " '{$item['warrant_type']}',";
  $query .= " '{$item['bond']}',";
  $query .= " '{$item['warrant_number']}',";
  $query .= " '{$item['offence_description']}'";
  $query .= " )";
  echo $query . "\n";
  // run query here
}
}

3:
If this is your own site then don't read on, but if it's not your own site and this is a paid job for a client then..

do you not think there is something a bit wrong about taking on work which you obviously can't do, telling the client you can, then continually asking hard working people to take time out from their own working days to both teach you and complete your work for you?

There is such an increase in people just saying "I know PHP" taking on work then getting the helpful people on this list and others to do it for them, and it really really sucks. If you can't do the work don't take it on, if you get genuinely stuck then ask - but don't just copy and paste a clients job description here with some random code and expect others to do it for you.

In the time you've spent asking and waiting, you could have learnt how to do it yourself.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux