Re: [PHP] curl and variable parameters in hyperlink

2010-11-24 Thread Bob Keightley
Guess I've not explained this very well.

The external page I am fetching using another curl script has asp query 
hyperlinks in it. I do not know the variable names in each query or the 
values they have.

All I want to do is replace the external url referenced in those links with 
a url which is on my site (so that I can change style sheet, image locations 
etc.) but the parameters to the original asp query link have to be captured 
and passed to my php script for it to return data.  I know there must be a 
way of doing this as there's a site which is referencing the same third 
party site and doing the same thing, and no, they won't tell me how! 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] curl and variable parameters in hyperlink

2010-11-24 Thread Bob Keightley

 Thanks to all for your interest so far but as I said, new to PHP. Changed
POST to GET and all now working fine!

 Tommy, the third party site is fully aware of what I am doing. We pay them
to use the data, as do lots of other companies in our industry. Supplying
data is what they do. We could not use the site at all without being given a
valid user name. Far from 'preventing them being successful' the more users
they have the more successful they become. We do not 'pass the work as our
own' they are credited on our site as suppliers of the content, so there
really is no issue there.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] curl and variable parameters in hyperlink

2010-11-23 Thread Bob Keightley
First use of Curl so probably a very simple problem - I have a script which 
loads a third party web page into my site.  That page contains links which 
have variable parameters i.e. www.blahblah.asp?param1=xxxparam2=yyy.

Any clues as to what I need to do to pass these parameters in a curl script 
appreciated. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] curl and variable parameters in hyperlink

2010-11-23 Thread Bob Keightley

I already have a curl script that gets the web page, but it doesn't pass the
parameters

Being new to PHP I haven't the first idea how to modify it so that it does.

Script is as follows:

$url = http://www.xx.com/query.asp?param1=val1param2=val2;;

foreach ($_POST as $key=$post) {
$post=str_replace( , +, $post);
$url.=$key.=.$post.;
}

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$data = curl_exec($ch);
curl_close($ch);

$data=str_replace('.asp', '.php', $data);
echo $data;

This returns the web page, but ignores val1 and val2 which are necessary to
execute the query.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php