cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

FW: parsing url of returned page

From: <theexperts_at_allprodirect.com>
Date: Wed, 13 Mar 2002 21:40:22 -0500

(Re-sending because originally sent to admin by mistake)

Andrew,

If I understand correctly, the external page is taking a url you pass them,
adding some url encoded fields, and storing the result in a hidden form
field in the source code of the returned page. Correct? This would be so you
can link to that page and your site visitors can access info on that server
and then be returned to your site.

If so, you could use something like this: (where $content = results from
curl)

$regexp = '/<input type="hidden" name="var_name" value="([^"]*)">/Usi';
preg_match($regexp,$content,$matches);
$var_name = $matches[1];

This will find the field named "var_name" in the page source code and store
the contents of the value attribute in $var_name.

Just make sure the regular expression matches the way the field is layed out
in the source code.

-J.
Received on 2002-03-14