Need assistance with loop (to go t next page)

Experts,

My script works perfect.  However, I cannot go to the next page.  How do I correctly configure a loop?

There are generally about 40 to 60 open orders at any given time in increments of 25.

For example:
$url_2 = 'http://www.***electronics.com/b2b/openorders.php?search=&searchType=&start=0';
$url_2 = 'http://www.***electronics.com/b2b/openorders.php?search=&searchType=&start=25';
$url_2 = 'http://www.***electronics.com/b2b/openorders.php?search=&searchType=&start=50';
$url_2 = 'http://www.***electronics.com/b2b/openorders.php?search=&searchType=&start=75';


//NEED LOOP HERE (Increments of 25 - start=0, 25, 50 etc)

$url_2 = 'http://www.***electronics.com/b2b/openorders.php?search=&searchType=&start=0';//new url
	curl_setopt($ch, CURLOPT_URL,$url_2); // set url to go fetch
	curl_setopt($ch, CURLOPT_AUTOREFERER, true);
	curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
	curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
	$buffer2 = curl_exec($ch); // run the process
	//echo $buffer2;

Open in new window

lawrence_devAsked:
Who is Participating?
 
Ray PaseurCommented:
<?php // demo/temp_lawrence_dev.php

/**
 * See http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28634441.html
 * Ref http://php.net/manual/en/control-structures.for.php
 */
error_reporting(E_ALL);
echo '<pre>';


// CHOOSE YOUR MAX VALUE
$max = 150;

// LOOP, ADDING COUNT DATA TO THE END OF THE URL
for ($num = 0; $num <= $max; $num += 25)
{
    echo PHP_EOL . 'URL=' . $num;
}

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.