0

I'm trying to extract the page number of a ChannelAdvisor Inventory List but it always output EMPTY.

here is my code:

 <?php
$url = "https://merchant.channeladvisor.com/AM/MyInventory/View_Inventory.aspx?apid=32001263";
$str = file_get_contents($url);

preg_match('/<span id="Surround_ctl00_Surround_Content_Paging_ctl00_l1">&nbsp;of (.*?)<\/span>&nbsp;/',$str,$as);
var_dump($as);
?>

I'm trying to extract the 340..

Mhel
  • 167
  • 1
  • 11
  • Have you tried to compose regular expression iteratively, by adding small parts and check after? It's a common practice for every developer that cannot debug their code (yet). So remove the regex and start from the scratch, but check if the result is expected after each keystroke – zerkms Jun 01 '12 at 05:45
  • yes ive been doing that but it also output an empty value. – Mhel Jun 01 '12 at 05:58
  • If you open the URL in your browser, you'll see that it redirects you to a login page. That's why you don't get the page number. – flowfree Jun 01 '12 at 05:59
  • oh, how can I get to login to retrieve the page number? – Mhel Jun 01 '12 at 06:06

1 Answers1

0

You will probably want to investigate Curl, the address you are trying to access is HTTPS and requires authentication. This is probably why you aren't getting back any data.

PHP CURL

Community
  • 1
  • 1
David Stetler
  • 1,465
  • 10
  • 14