Pregunta

I'm developing a site for analyzing a store's data. I need the url part of my array to look like this:

array(
    'url'       => 'http://some.website.com:8080/SASStoredProcess/do?_username=user-123',
    '_password' => 'passwd',
    '_program'  => '/Utilisateurs/DARTIES3-2012/Mon dossier/analyse_dc',
    'annee'     => '2012',
    'ind'       => 'V',
    '_action'   => 'execute'
);

I currently have this and am struggling to convert it to the desired format:

array(
    'url' => 'url=http://some.website.com:8080/SASStoredProcess/do?_username=user-123&_password=passwd&_program=%2FUtilisateurs%2FDARTIES3-2012%2FMon+dossier%2Fanalyse_dc&annee=2012&ind=V&_action=execute',
    'otherKey' => 'otherValue'
);

Please can somebody help me to convert the URL in the second code block to look like the first code block? Thanks in advance.

¿Fue útil?

Solución

So this will extract the url in the form you want, as $url:

$myArray = array(
    'url' => 'url=http://some.website.com:8080/SASStoredProcess/do?_username=user-123&_password=passwd&_program=%2FUtilisateurs%2FDARTIES3-2012%2FMon+dossier%2Fanalyse_dc&annee=2012&ind=V&_action=execute',
    'otherKey' => 'otherValue'
);
parse_str($myArray['url']);
echo $url;

You will need to decide where it needs to go next and how you get it there.

Otros consejos

You might want to use: parse_url() and parse_str() over your $array['url']

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top