I Have one string which contains the link of prev and next page link:
Link: "<https://{shop}.myshopify.com/admin/api/{version}/products.json?page_info={next_page_info}&limit={limit}>; rel={next}, <https://{shop}.myshopify.com/admin/api/{version}/products.json?page_info={prev_page_info}&limit={limit}>; rel={previous}"
expecting output
array(
'next' => {next_page_info},
'prev' => {prev_page_info}
);
link string has also some condition as below:
-
string has both next and prev link
-
string has only next link Output should be array(‘next’ => ‘{next_page_info}’ );
-
string has only prev link Output should be array(‘prev’ => ‘{prev_page_info}’);
2
Answers
You can try this function I wrote just send it the links text or the whole header info
it will return the links like this as array
To return page_info for all types of URL.
Response Dump