The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. February 11, 2012, 02:06:37 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: php curl problem  (Read 872 times)
LondonSEO
Rookie
**
Offline Offline

Posts: 15


View Profile
« on: November 22, 2009, 11:35:08 AM »

I'm trying to make this script work,

I want to display the results for the user who sent a form in the TARGET site,

The final results in the TARGET site should be displayed in the target site not on my side. Any ideas?


Code:
<?

$ch = curl_init('http://www1.octopustravel.com/searchAction.form');
$post = "brandCode=LON_OTUK01_ONL&searchName=Singapore&checkInDate=01/12/2009&checkOutDate=10/12/2009&isFromHomePage=Y&naviName=home";

curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml; charset=UTF-8"));

curl_setopt($ch, CURLOPT_USERAGENT, $useragent);

$result = curl_exec($ch);
curl_close($ch);
print $result;

?>
Logged

No links in signatures please
deregular
Expert
****
Offline Offline

Posts: 172


View Profile
« Reply #1 on: December 04, 2009, 01:34:20 AM »

Just looked,... no results for Singapore.

They are using an iframe or something to fetch the data by the looks of it.
Logged
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #2 on: December 04, 2009, 07:05:02 AM »

The user won't have the cookies from your cURL request, and you can't give them to him. I'm not sure you can do what you're trying to do this way.
Logged

hai
serialnoob
Journeyman
***
Offline Offline

Posts: 86


View Profile
« Reply #3 on: December 10, 2009, 09:48:45 PM »

 How about "checkInDate=12%2F21%2F2009&checkOutDate=12%2F22%2F2009" instead ?
Logged

Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill
herbacious
Journeyman
***
Offline Offline

Posts: 51


View Profile
« Reply #4 on: March 23, 2010, 01:20:16 AM »

yeah post should be urlencoded surely?
Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!