A function in PHP returns me following js snippet in a string
<script type="text/javascript">
function gformRedirect()
{
document.location.href='https://plamsn.web/fr/demande-de-pret?montant=400%24&email=jon%40doe.com';
}
</script>
I want to extract, href from the above string
https://plamsn.web/fr/demande-de-pret?montant=400%24&email=jon%40doe.com
I tried the following
$hrefStartIndex = strpos($redirect, 'http');
$hrefEndIndex = strpos($redirect, ';}');
$href = substr($redirect, $hrefStartIndex, $hrefEndIndex);
This seems to give some issues and i am not sure if this is how i should go with, any pointer on how to go about it will be appreciated.
Thanks,