inactive Posted January 14, 2008 Share Posted January 14, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85951-solved-curl-post-not-working/ Share on other sites More sharing options...
tinker Posted January 14, 2008 Share Posted January 14, 2008 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!) Quote Link to comment https://forums.phpfreaks.com/topic/85951-solved-curl-post-not-working/#findComment-438856 Share on other sites More sharing options...
inactive Posted January 14, 2008 Author Share Posted January 14, 2008 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... Quote Link to comment https://forums.phpfreaks.com/topic/85951-solved-curl-post-not-working/#findComment-439340 Share on other sites More sharing options...
KrisNz Posted January 14, 2008 Share Posted January 14, 2008 the field name is "inquirynumber" not "enquirynumber". You don't need that SSL stuff either since its not https. Quote Link to comment https://forums.phpfreaks.com/topic/85951-solved-curl-post-not-working/#findComment-439352 Share on other sites More sharing options...
inactive Posted January 15, 2008 Author Share Posted January 15, 2008 gah! i think thats it. thanks Kris. i guess thats why they say you should never proff your own code. and yes i could probably get rid of the ssl stuff too... i'll try it tonight. thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/85951-solved-curl-post-not-working/#findComment-439373 Share on other sites More sharing options...
inactive Posted January 15, 2008 Author Share Posted January 15, 2008 yep, as you said Kris it was just the spelling of the post var. thanks heaps. Quote Link to comment https://forums.phpfreaks.com/topic/85951-solved-curl-post-not-working/#findComment-439613 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.