Developer Forum [ All Topics | New Topic ]

Thread: how can i show the repnet inventory listing in Wordpress(open source of PHP)

I cant find any plugin or api or php code for show the rapnet inventory listing in php. Please help me.

Thanks in advance


>> add a comment
Amardeep Singh
06/03/2011 09:21


2 Replies:

<?php
//1 - Authenticate with TechNet. The authentication ticket will be stored in $auth_ticket. Note this MUST be HTTPS.
$auth_url = "https://technet.rapaport.com/HTTP/Authenticate.aspx";
$post_string = "username=xxxxx&password=" . urlencode("xxxxx");

//create HTTP POST request with curl:
$request = curl_init($auth_url); // initiate curl object
curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.
$auth_ticket = curl_exec($request); // execute curl post and store results in $auth_ticket
curl_close ($request);


//2 - prepare HTTP request for data. Copy the URL from the RapLink Feed page in RapNet.com:
// go to: http://www.rapnet.com/RapNet/DownloadListings/Download.aspx, choose your parameters, and click
// generate code. Make sure to specify the columns wanted. This can produce a very long URL.

$feed_url = "http://technet.rapaport.com/HTTP/RapLink/download.aspx?SortBy=Owner&White=1&Fancy=1&Programmatically=yes&Version=1.0";
$feed_url .= "&ticket=".$auth_ticket; //add authentication ticket:

//prepare to save response as file.
$fp = fopen('aa.csv', 'wb');
if ($fp == FALSE)
{
echo "File not opened";
exit;
}

//create HTTP GET request with curl
$request = curl_init($feed_url); // initiate curl object
curl_setopt($request, CURLOPT_FILE, $fp); //Ask cURL to write the contents to a file
curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
curl_setopt($request, CURLOPT_TIMEOUT, 30000); //set timeout to 5 mins
curl_exec($request); // execute curl post
// additional options may be required depending upon your server configuration
// you can find documentation on curl options at http://www.php.net/curl_setopt
curl_close ($request); // close curl object
fclose($fp); //close file;


//Special thanks to David Meyers for helping me to create the sample file. \\ :-) //
?>


>> add a comment
I have use this code but its not working
6/3/2011 9:27:00 AM
Hi, Can i use this code for core php.

>> add a comment
VAIBHAV
6/6/2011 2:31:00 AM