Jump to content

Recommended Posts

hey guys kinda new to this

trying to use curl to submit some post vars to a page, and then print the results.

i've tested submitting to my own page, and the vars are coming through fine, but

when i submit to the actual page im trying to use (the tracking page for australian

air express), the retuned page is just the normal page as though no post vars went

through. it actually says 'Please enter a Consignment/Article number before

requesting a search,' which i take to mean it know its been submitted to, but didnt

pull the var thats meant to be looked up (enquirynumber).

 

Ok so heres my code

 

$url = 'http://203.43.1.230/scripts/cgiip.exe/WService=wtsaae/inquiry.w';
$params = "searchbutton=Search&enquirynumber=UXW81825";
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

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

echo $result; 

 

and you can test whats meant to happen by going to

http://203.43.1.230/track/inquiry.html and entering

UXW81825.

 

Is there anything wrong with my code? or is something

different betwen refferencing to an external file, rather

that the local file i tested it on?

 

I know that the site is not filtering out based on referer

or anything, because i have managed to do this before

using snoopy (php class).

 

Hope i havent been too confusing here, and would love

any comment or suggestions, or help! lol

 

Thanks guys

 

mitch.

Link to comment
https://forums.phpfreaks.com/topic/85951-solved-curl-post-not-working/
Share on other sites

Seem's ok, however if they want to keep people coming to their site's service (and may sell access to their db) then they may have a clause in their script which checks $_SERVER['HTTP_REFERER' ] to see if it's internal or not and redirect if not... Dunnie Know Mate! (Sorry for that!)

hmmm yeah thats what i suspected, however i used that snoopy class to pull the site, and it works fine...i dont know whether snoopy automatically spoofs the referer header...i doubt it... any other suggestions? i would prefer not to have to use snoopy, thats all...

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.