Jump to content

make cURL so url it lands on is the actual url trying to post to


Recommended Posts

i have a php page which reads GET parameters

and if one of the variables is set, then use cURL fucntions to transfer those variables to another webpage.

but instead of seeing 'http://intranetServer:8080/reports/view.jsp' in URL, i see 'readParameters.php' still which disturbs me.

Anyway way to make it so both content AND URL changes (right now the content on the page is correct)?

 

//readParameters.php

if($_GET['action']=='completed')

{

 

$url = 'http://intranetServer:8080/reports/view.jsp';

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

 

curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// Follow any Location headers

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// dont echo output

 

$postfields = $_GET; //tranfser the GET parameters to this jsp page via POST now

 

curl_setopt($ch, CURLOPT_POST, 1);// Alert cURL to the fact that we're doing a POST, and pass the associative array for POSTing.

curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

 

$output = curl_exec($ch);

curl_close($ch);

 

}

 

 

From my curl posting experience, I don't think it's possible for you to see the url of the script processing the post variables. If you hadn't set return transfer then you would have been redirected, and you would have seen it, but since you are trying to stay on the same page it isn't going to work like that.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.