I
I
Ivan2019-02-01 21:51:46
PHP
Ivan, 2019-02-01 21:51:46

What is the reason for the refusal to parse by url?

I don't know how to ask the right question.
Through cURL, I get a catalog of goods from a JSON source and save the goods to my database.
I ran into an inexplicable problem, parsing from different urls behaves differently, despite the fact that the difference in the url is only one digit, for example:
site.ru/market/ware?page=1&category= 1
and

site.ru/market/ware? page=1&category= 11
The second link, more precisely, parsing on it works 100%, parsing on the first link does not want to work, although the JSON content is completely identical .
The whole day I could not understand what the reason was, I determined the reason only by searching the addresses, the result is higher.
Tell me, what could be the problem, because of which category=1 does not want to work?
I thought about how you can change the url to parse from category 1, but I couldn’t think of anything.
The category number is inserted like this

for ($page = 1; $page <= 50; $page++) {
$item = $ware->getMarket('1', $page);

...
class
$response = (array)@json_decode($this->request('GET', 'http://site.ru/market/ware?page=' . $page . '&category=' . $category)['body'], true);

or so (tried in different ways, the result is the same)
$response = (array)@json_decode($this->request('GET', 'http://site.ru/market/ware?category=' . $category . '&page=' . $page)['body'], true);

It seems to me that the reason is that the category is indicated by one number, all categories with two numbers or a letter designation work correctly, from 1 to 9 do not work.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question