mudgil.gaurav Posted July 14, 2009 Share Posted July 14, 2009 Hi All, I want to get all my bills from the following website https://svclink.miworld.com.sg/ssonline/login/login.jsp?cat=account&link=viewbill&layer=lyr1&content=viewbill&errorcode=null&appurl=https%3A%2F%2Fsvclink.miworld.com.sg%2Fssonline%2Flogin%2Fgoto.jsp%3Fappid%3DANYPostAny%26urlPath%3Dhttps%253A%252F%252Fsvclink.miworld.com.sg%252Fssonline%252Faccount%252Fmiworld_account.jsp%26cat%3Daccount%26link%3Dviewbill%26layer%3Dlyr1%26content%3Dviewbill&sessStat=0 Can anybody suggest me how to send my mobile number , password, account number with the curl request so that i can get the required result. Any help or suggestion would be greatly appriciated. Thanks Link to comment https://forums.phpfreaks.com/topic/165919-php-curl-help-needed/ Share on other sites More sharing options...
phporcaffeine Posted July 14, 2009 Share Posted July 14, 2009 I don't think cURL is where you need to be looking. You need to make a POST request to the website. Example: function makePost($url, $referer, $_data) { $data = array(); while(list($n,$v) = each($_data)){ $data[] = "$n=$v"; } $data = implode('&', $data); $url = parse_url($url); if ($url['scheme'] != 'http') { die('Only HTTP request are supported !'); } $host = $url['host']; $path = $url['path']; //CREATE A SOCKET $fp = fsockopen($host, 80); //HEADERS fputs($fp, "POST $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Referer: $referer\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ". strlen($data) ."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data); $result = ''; while(!feof($fp)) { $result .= fgets($fp, 128); } fclose($fp); $result = explode("\r\n\r\n", $result, 2); $header = isset($result[0]) ? $result[0] : ''; $content = isset($result[1]) ? $result[1] : ''; return array($header, $content); } $data = array( 'field1' => 'value1', 'field2' => 'value2', 'field3' => 'value3' ); list($header, $content) = makePost("http://www.example.com/", "http://www.referersite.com/", $data); print $content; Link to comment https://forums.phpfreaks.com/topic/165919-php-curl-help-needed/#findComment-875121 Share on other sites More sharing options...
JonnoTheDev Posted July 14, 2009 Share Posted July 14, 2009 I don't think cURL is where you need to be looking. You need to make a POST request to the website. cURL can make any request and is much more efficient that any other method. Essentially cURL is a web browser for php. You need the exact field/parameter names to make a POST or GET request. You may need to login to the website via cURL and set a session / cookie (fopen / fputs / fsockopen cannot do this so you would never authenticate to the remote site). Please post the code you have. Link to comment https://forums.phpfreaks.com/topic/165919-php-curl-help-needed/#findComment-875207 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.