url = $url; // make the curl request and update the path $request->getHttpCode(); // end on an error if ($request->error) { $error = $request->error; break; } // if we have a redirect to follow, update our working $url $url = ($request->next) ? $request->next : false; // update our code $code = ($request->code) ? $request->code : false; } while (substr($code, 0, 1) != 2); } else { $error = [ 'type' => 'search', 'message' => 'There was an issue with URL you searched. Make sure it\'s a well-formed URL.' ]; } } ?>